在rowdatabound中使用viewstate [英] Use of viewstate in rowdatabound

查看:92
本文介绍了在rowdatabound中使用viewstate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我试图在网格的RowDataBound事件中使用viewstate.

Hello friends,
I trying to use viewstate in RowDataBound event of grid.

ViewState.Add("ddlGClient", ddlGClient)
ViewState.Add("ddlGBrandCategory", ddlGBrandCategory)


问题是,当我单击编辑链接时,网格无法进入编辑模式.
但是,当我删除代码时,网格将进入编辑模式(EditItemTemplete中的控件可见)

基本上,我正在尝试在网格中级联下拉菜单.我将此控件保存在viewstate中,然后将其传递给以下事件


Problem is, when I click on edit link the grid does not go to edit mode.
But when I remove the code, the grid goes to edit mode (Controls in EditItemTemplete gets visible)

Basically what I''m trying cascading dropdown in grid. I''m saving this control in viewstate and then I''m pass it to following event

Protected Sub ddlGClient_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)      fillBrandCategorydropdown(CType(ViewState(ddlGClient),DropDownList).SelectedValue)
End Sub





What is the logic behind grid not getting into edit mode?<br />
Why the RowDataBound event is called twice for each row?



有什么主意吗?

在此先感谢



Any idea?

Thanks in advance

推荐答案

在ASP.Net中检查级联下拉菜单
http://www.dotnetcurry.com/ShowArticle.aspx?ID=221 [ ^ ]
Check this for cascading dropdown in ASP.Net
http://www.dotnetcurry.com/ShowArticle.aspx?ID=221[^]


这篇关于在rowdatabound中使用viewstate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆