ASP。净部分回发值问题

时间:2021-11-10 03:38:44

In my page_load I am creating a

在我的page_load中,我正在创建一个

HiddenField newField= new HiddenField();

and then I am assigning newField.ID = "someid" and Value="0" to it. on a partial postback (triggered by an UpdatePanel) i am then checking

然后我给newField赋值。ID =" someid"值="0"然后在部分回发(由UpdatePanel触发)上检查

Request.Form["someid"]

in the panel_Load event during the postback. but the request returns null as someid wasn't posted back. (not contained in the Request.Form collection) Why could this be?

在回发期间的panel_Load事件中。但是请求返回null,因为someid没有被返回。(不包含在请求中。表格收集)为什么会这样?

Thanks

谢谢

1 个解决方案

#1


3  

ASP.NET mangles the ID when rendered to the client by default. To access it from the Form collection, try this:

ASP。NET在默认情况下将ID呈现给客户端时进行管理。要从表单集合中访问它,请尝试以下操作:

Request.Form[newField.ClientID]

#1


3  

ASP.NET mangles the ID when rendered to the client by default. To access it from the Form collection, try this:

ASP。NET在默认情况下将ID呈现给客户端时进行管理。要从表单集合中访问它,请尝试以下操作:

Request.Form[newField.ClientID]