跪求GridViewHelper 在论坛里发现了一个好用的类GridViewHelper,但是论坛提供的地址http://www.agrinei.com/gridviewhelper/gridviewhelpersample_en.zip 怎么都没有办法下载,请问谁有,能给我一个新的链接。或者发到 万分感谢!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Collections;using BusinessLogic;public class GridViewHelper{ public GridViewHelper() { // // TODO: 在此处添加构造函数逻辑 // } /// <summary> /// 得到GridView中选中的主键值 /// </summary> /// <param name="gv">GridView对象</param> /// <returns>IEnumerable对象,里面是选中的记录的主键</returns> public static IEnumerable GetSelectedDataKeys(GridView gv) { return GetSelectedDataKeys(gv, "GridViewID"); } /// <summary> /// 得到GridView中选中的主键值 /// </summary> /// <param name="gv">GridView对象</param> /// <param name="checkboxID">GridView中CheckBox控件的ID</param> /// <returns>IEnumerable对象,里面是选中的记录的主键</returns> public static IEnumerable GetSelectedDataKeys(GridView gv, string checkboxID) { foreach (GridViewRow gvr in gv.Rows) { if (gvr.RowType == DataControlRowType.DataRow && gvr.FindControl(checkboxID) != null && ((CheckBox)gvr.FindControl(checkboxID)).Checked) { yield return gv.DataKeys[gvr.RowIndex].Value.ToString(); } } } /// <summary> /// 得到GridView中选中的主键值 /// </summary> /// <param name="gv">GridView对象</param> /// <returns>选中的记录的主键值</returns> public static string GetSelectedDataKey(GridView gv) { return GetSelectedDataKey(gv, "GridViewID"); } /// <summary> /// 得到GridView中选中的主键值 /// </summary> /// <param name="gv">GridView对象</param> /// <param name="checkboxID">GridView中CheckBox控件的ID</param> /// <returns>选中的记录的主键值</returns> public static string GetSelectedDataKey(GridView gv, string checkboxID) { foreach (GridViewRow gvr in gv.Rows) { if (gvr.RowType == DataControlRowType.DataRow && gvr.FindControl(checkboxID) != null && ((CheckBox)gvr.FindControl(checkboxID)).Checked) { return gv.DataKeys[gvr.RowIndex].Value.ToString(); } } return ""; } /// <summary> /// 添加鼠标移动变换底色效果,并增加鼠标双击某行跳转到指定url功能 /// </summary> /// <param name="gv">要进行处理的GridView</param> /// <param name="mouseDoubleClickForwardUrl">鼠标双击某行跳转到指定url</param> public static void SetMouseOverColorAndDbClickUrl(GridView gv, string mouseDoubleClickForwardUrl) { //设定Gridview控件中每行数据的脚本效果 string MouseOverBgColor = ConfigurationManager.AppSettings[SystemConst.CONFIG_GRIDVIEW_MOUSEOVERBGCOLOR]; foreach (GridViewRow row in gv.Rows) { if (row.RowType == DataControlRowType.DataRow) { //添加自定义属性,当鼠标移过来时设置该行的背景色,并保存原背景色 //鼠标划过时改变光标 Modify by 陈根发 20070802 row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='" + MouseOverBgColor + "';this.style.cursor = 'hand'"); //添加自定义属性,当鼠标移走时还原该行的背景色 row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;this.style.cursor = 'default'"); if (mouseDoubleClickForwardUrl != null && mouseDoubleClickForwardUrl.Trim().Length > 0) { //添加自定义属性,当鼠标双击该行时,跳转到该行数据的编辑页面 row.Attributes.Add("ondblclick", "location='" + mouseDoubleClickForwardUrl + gv.DataKeys[row.RowIndex].Value.ToString() + "'"); } } } } /// <summary> /// /// 添加鼠标移动变换底色效果,并增加鼠标双击某行弹出新的指定url页面功能 /// </summary> /// <param name="gv">要进行处理的GridView</param> /// <param name="mouseDoubleClickForwardUrl">鼠标双击某行跳转到指定url</param> public static void SetMouseOverColorAndDbClickUrl(GridView gv, string mouseDoubleClickForwardUrl, int left, int top, int width, int height) { //设定Gridview控件中每行数据的脚本效果 string MouseOverBgColor = ConfigurationManager.AppSettings[SystemConst.CONFIG_GRIDVIEW_MOUSEOVERBGCOLOR]; foreach (GridViewRow row in gv.Rows) { if (row.RowType == DataControlRowType.DataRow) { //添加自定义属性,当鼠标移过来时设置该行的背景色,并保存原背景色 //鼠标划过时改变光标 Modify by 陈根发 20070802 row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='" + MouseOverBgColor + "';this.style.cursor = 'hand'"); //添加自定义属性,当鼠标移走时还原该行的背景色 row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;this.style.cursor = 'default'"); if (mouseDoubleClickForwardUrl != null && mouseDoubleClickForwardUrl.Trim().Length > 0) { //添加自定义属性,当鼠标双击该行时,跳转到该行数据的编辑页面 string url = string.Format("window.open('{0}','','left={1},top={2},height={3},width={4},menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no');", mouseDoubleClickForwardUrl + gv.DataKeys[row.RowIndex].Value.ToString(), left, top, width, height); row.Attributes.Add("ondblclick", url); } } } } } asp.net 同时插入三张表 普通网站如何做并发的系统? 单点登录RTX IIS未将对象引用至实例 在asp.net中,即aspx页里面引用外部js文件后,但是却在aspx页面中访问不到外部js文件中的方法,怎么办? 和数据库没有关系的分页显示。。。。? 谁能告诉我这个存储过程里面的问题是什么啊? Windows 更新后出现错误请各位帮忙 HTTP500后 取消勾选“友好http信息错误”能正常访问 关于session丢失问题 新手问题,怎样把异常信息发送给错误页面? Session问题·····!!!!!!!!!!!!! 郁闷,asp.net2.0 中水晶报表没有工具栏?
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using BusinessLogic;public class GridViewHelper
{
public GridViewHelper()
{
//
// TODO: 在此处添加构造函数逻辑
//
} /// <summary>
/// 得到GridView中选中的主键值 /// </summary>
/// <param name="gv">GridView对象</param>
/// <returns>IEnumerable对象,里面是选中的记录的主键</returns>
public static IEnumerable GetSelectedDataKeys(GridView gv)
{
return GetSelectedDataKeys(gv, "GridViewID");
} /// <summary>
/// 得到GridView中选中的主键值 /// </summary>
/// <param name="gv">GridView对象</param>
/// <param name="checkboxID">GridView中CheckBox控件的ID</param>
/// <returns>IEnumerable对象,里面是选中的记录的主键</returns>
public static IEnumerable GetSelectedDataKeys(GridView gv, string checkboxID)
{
foreach (GridViewRow gvr in gv.Rows)
{
if (gvr.RowType == DataControlRowType.DataRow && gvr.FindControl(checkboxID) != null && ((CheckBox)gvr.FindControl(checkboxID)).Checked)
{
yield return gv.DataKeys[gvr.RowIndex].Value.ToString();
}
}
} /// <summary>
/// 得到GridView中选中的主键值 /// </summary>
/// <param name="gv">GridView对象</param>
/// <returns>选中的记录的主键值</returns>
public static string GetSelectedDataKey(GridView gv)
{
return GetSelectedDataKey(gv, "GridViewID");
} /// <summary>
/// 得到GridView中选中的主键值 /// </summary>
/// <param name="gv">GridView对象</param>
/// <param name="checkboxID">GridView中CheckBox控件的ID</param>
/// <returns>选中的记录的主键值</returns>
public static string GetSelectedDataKey(GridView gv, string checkboxID)
{
foreach (GridViewRow gvr in gv.Rows)
{
if (gvr.RowType == DataControlRowType.DataRow && gvr.FindControl(checkboxID) != null && ((CheckBox)gvr.FindControl(checkboxID)).Checked)
{
return gv.DataKeys[gvr.RowIndex].Value.ToString();
}
}
return "";
} /// <summary>
/// 添加鼠标移动变换底色效果,并增加鼠标双击某行跳转到指定url功能
/// </summary>
/// <param name="gv">要进行处理的GridView</param>
/// <param name="mouseDoubleClickForwardUrl">鼠标双击某行跳转到指定url</param>
public static void SetMouseOverColorAndDbClickUrl(GridView gv, string mouseDoubleClickForwardUrl)
{
//设定Gridview控件中每行数据的脚本效果
string MouseOverBgColor = ConfigurationManager.AppSettings[SystemConst.CONFIG_GRIDVIEW_MOUSEOVERBGCOLOR];
foreach (GridViewRow row in gv.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
//添加自定义属性,当鼠标移过来时设置该行的背景色,并保存原背景色 //鼠标划过时改变光标 Modify by 陈根发 20070802
row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='" + MouseOverBgColor + "';this.style.cursor = 'hand'");
//添加自定义属性,当鼠标移走时还原该行的背景色
row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;this.style.cursor = 'default'"); if (mouseDoubleClickForwardUrl != null && mouseDoubleClickForwardUrl.Trim().Length > 0)
{
//添加自定义属性,当鼠标双击该行时,跳转到该行数据的编辑页面
row.Attributes.Add("ondblclick", "location='" + mouseDoubleClickForwardUrl + gv.DataKeys[row.RowIndex].Value.ToString() + "'");
}
}
}
} /// <summary>
/// /// 添加鼠标移动变换底色效果,并增加鼠标双击某行弹出新的指定url页面功能
/// </summary>
/// <param name="gv">要进行处理的GridView</param>
/// <param name="mouseDoubleClickForwardUrl">鼠标双击某行跳转到指定url</param>
public static void SetMouseOverColorAndDbClickUrl(GridView gv, string mouseDoubleClickForwardUrl, int left, int top, int width, int height)
{
//设定Gridview控件中每行数据的脚本效果
string MouseOverBgColor = ConfigurationManager.AppSettings[SystemConst.CONFIG_GRIDVIEW_MOUSEOVERBGCOLOR];
foreach (GridViewRow row in gv.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
//添加自定义属性,当鼠标移过来时设置该行的背景色,并保存原背景色
//鼠标划过时改变光标 Modify by 陈根发 20070802
row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='" + MouseOverBgColor + "';this.style.cursor = 'hand'");
//添加自定义属性,当鼠标移走时还原该行的背景色
row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;this.style.cursor = 'default'"); if (mouseDoubleClickForwardUrl != null && mouseDoubleClickForwardUrl.Trim().Length > 0)
{
//添加自定义属性,当鼠标双击该行时,跳转到该行数据的编辑页面
string url = string.Format("window.open('{0}','','left={1},top={2},height={3},width={4},menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no');", mouseDoubleClickForwardUrl + gv.DataKeys[row.RowIndex].Value.ToString(), left, top, width, height);
row.Attributes.Add("ondblclick", url);
}
}
}
}
}