[黑桃六]凭借Cookie来隐藏GridView一些列后的刷新滞后的问题。按提示程度给分。
请大家仔细看看,我已经尽量简化了代码。
Button_Click事件,此按钮是“隐藏哪些列”的确认按钮
--------------------------------------------------
Dim li As ListItem
Dim v As HttpCookie
'存入Cookie
For Each li In CheckBoxList1.Items
v = New HttpCookie( "c " + li.Value)
If li.Selected = False Then
v.Value = 0
Else
v.Value = 1
End If
v.Expires = Now.AddDays(15)
Response.Cookies.Add(v)
Next
'绑定GridView1事件。
BindGV1()
BindGV1()方法
------------------------------------------
...
GridView1.Datasource=Dataset1
GridView1.DataBind()
GridView1_RowDataBound事件
-------------------------------------------
'由Cookie控制显示
Dim li As ListItem
Try
For Each li In CheckBoxList1.Items
If Server.UrlDecode(Request.Cookies( "c " + li.Value.ToString.Trim()).Value) = "0 " Then
e.Row.Cells(li.Value).Style( "display ") = "none "
Else
e.Row.Cells(li.Value).Style( "display ") = " "
End If