在gride视图中隐藏列 [英] hidding column in gride view
本文介绍了在gride视图中隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
i有时候看看arrounf = d
i需要隐藏从会话加载的数据表中的列
i尝试使用mapping.hidden但是没有工作
i已将它们添加到会话隐藏但它们出现在第2页
可能有任何帮助请
这是第2页页面加载
受保护的 Sub Page_Load( ByVal 发件人作为 对象,< span class =code-keyword> ByVal e As System.EventArgs)句柄 < span class =code-keyword> Me .Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
setMenu()
Response.Cache.SetCacheability(System.Web) .HttpCacheability.NoCache)
Response.Cache.SetNoStore()
lbldte.Text = DateAndTime.No w.ToShortDateString
如果 Page.PreviousPage IsNot 没有 然后
昏暗 GridView1 正如 GridView = DirectCast (Page.PreviousPage.FindControl( GridView1),GridView)
结束 如果
如果会话( ProductsTable ) IsNot 没什么 然后
dt = DirectCast (会话( ProductsTable ),Dat aTable)
GridView1.DataSource = dt
GridView1.DataBind()
结束 如果
如果 不 IsPostBack 然后
' 检查网页是否为第一次加载。
' 在ViewState中保存上一页网址
ViewState( PreviousPage)= Request.UrlReferrer
结束 如果
结束 Sub
解决方案
dt.Columns。删除( columnName);
dt.Columns.RemoveAt(columnIndex);
试试看看。
< blockquote>删除将删除
里面的值,但我保留它,因为我在按钮单击时将其插入数据库
我应该在第2页后尝试这个在添加到会话之前加载会话
或第1页
如第1页所示我已将它们隐藏起来,但它们出现在第2页
hi
i have beed lookin arrounf=d for sometime
i need to hide column in a datatable loaded from session
i tried mapping.hidden but did nt work
i already add them to session hidden but they appear in page 2
may any help pls
this is page 2 page load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
setMenu()
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache)
Response.Cache.SetNoStore()
lbldte.Text = DateAndTime.Now.ToShortDateString
If Page.PreviousPage IsNot Nothing Then
Dim GridView1 As GridView = DirectCast(Page.PreviousPage.FindControl("GridView1"), GridView)
End If
If Session("ProductsTable") IsNot Nothing Then
dt = DirectCast(Session("ProductsTable"), DataTable)
GridView1.DataSource = dt
GridView1.DataBind()
End If
If Not IsPostBack Then
'check if the webpage is loaded for the first time.
'Saves the Previous page url in ViewState
ViewState("PreviousPage") = Request.UrlReferrer
End If
End Sub
解决方案
dt.Columns.Remove("columnName"); dt.Columns.RemoveAt(columnIndex);
Try this and see.
the remove will delete the value inside
but i wana keep it as i insert it to database on button click
should i try this in page 2 after loading session
or page 1 before adding to session
as in page 1 i already have them hidden , but they appear in page 2
这篇关于在gride视图中隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文