asp.netGridview分页保存选项
#region//"Revision:1.00CreatedDate:2013/08/02CreatedID:Una[#1300071]增加多?框
///<summary>
///Session?取多?框值
///</summary>
privatevoidRememberOldValues()
{
ArrayListcategoryIDList=newArrayList();
stringindex="";
foreach(GridViewRowrowingridView.Rows)
{
index=(string)gridView.DataKeys[row.RowIndex].Value;
boolresult=((CheckBox)row.FindControl("DeleteThis")).Checked;
//CheckintheSession
if(Session["id"]!=null)
categoryIDList=(ArrayList)Session["id"];
if(result)
{
if(!categoryIDList.Contains(index))
categoryIDList.Add(index);
}
else
categoryIDList.Remove(index);
}
if(categoryIDList!=null&&categoryIDList.Count>0)
Session["id"]=categoryIDList;
}
///<summary>
///Session分??r之前多?框??rue
///</summary>
privatevoidRePopulateValues()
{
ArrayListcategoryIDList=(ArrayList)Session["id"];
if(categoryIDList!=null&&categoryIDList.Count>0)
{
foreach(GridViewRowrowingridView.Rows)
{
stringindex=(string)gridView.DataKeys[row.RowIndex].Value;
if(categoryIDList.Contains(index))
{
CheckBoxmyCheckBox=(CheckBox)row.FindControl("DeleteThis");
myCheckBox.Checked=true;
}
}
}
}
#endregion
protectedvoidgridView_PageIndexChanging(objectsender,GridViewPageEventArgse)
{
RememberOldValues();
gridView.PageIndex=e.NewPageIndex;
BindData();
RePopulateValues();
}
protectedvoidbtnSelect_Click(objectsender,EventArgse)
{
stringitems="";
ArrayListcategoryIDList=newArrayList();
stringindex="";
foreach(GridViewRowrowingridView.Rows)
{
index=(string)gridView.DataKeys[row.RowIndex].Value;
boolresult=((CheckBox)row.FindControl("DeleteThis")).Checked;
//CheckintheSession
if(Session["id"]!=null)
categoryIDList=(ArrayList)Session["id"];
if(result)
{
if(!categoryIDList.Contains(index))
categoryIDList.Add(index);
}
else
categoryIDList.Remove(index);
}
if(categoryIDList!=null&&categoryIDList.Count>0)
for(inti=0;i<categoryIDList.Count;i++)
{
items+=categoryIDList[i]+",";
}
items=items.Substring(0,items.Length-1);
ScriptManager.RegisterStartupScript(this,this.GetType(),"","check(""+items+"");",true);
Session.Remove("id");
}
相关文章
- css分页效果_asp中数字分页样式
- asp.net dropdownlist的值怎么设置_ASPNET程序开发招聘
- 灵活操作:ASP连接MySQL(asp连接mysql)
- 库ASP实现MySQL数据库的轻松访问(asp读取mysql数据)
- ASP如何使用代码登录MySQL数据库(asp登陆mysql代码)
- ASP与MySQL结合最佳网站开发方案(asp接mysql)
- 快速了解如何在ASP环境下安装MySQL(asp 安装mysql)
- 灵活运用ASP与MySQL连接的妙用(asp与mysql连接)
- MySQL与ASP结合,为网站带来绿色发展(asp mysql 绿色)
- ASP搭配MySQL实现完美源代码(asp mysql源代码)
- 利用ASP 与 Oracle 技术实现项目进度管理(asp oracle项目)
- 几个常用的ASP函数
- ASP.NET技巧:为Blog打造个性日历
- 如何通过ASP管理NT帐号
- ASP.NET高性能分页代码
- ASP实现长文章分页
- asp.net中获取远程网页的内容之一(downmoon原创)
- ASP通用分页样式函数代码
- asp.net下定制日期输出格式的代码
- Asp.net中防止用户多次登录的方法
- 比较完整的asp.net学习流程
- asp.net(C#)动态添加非ASP的标准html控件(如添加Script标签)
- ASP.NET调用百度搜索引擎的代码
- ASP分页时计算页面总数的几种算法小结
- asp.net文章分页显示实现代码
- ASP程序中使用断开的数据记录集的代码
- asp.net连接查询SQL数据库并把结果显示在网页上(2种方法)
- Asp.netajax实现任务提示页面的简单代码