开发者

Request.Form[MyControl.ClientID] is Null

开发者 https://www.devze.com 2023-03-16 11:28 出处:网络
I\'ve noticed that, during a postback, Request.Form[MyControl.ClientID] is null. However, Request.Form[MyControl.Name] contains the expected value.

I've noticed that, during a postback, Request.Form[MyControl.ClientID] is null. However, Request.Form[MyControl.Name] contains the expected value.

This is unexpected. Is this d开发者_高级运维ocumented somewhere?


This is correct - browser will use control's name (and not ID) for posting the values. Further, use Request.Form[MyControl.UniqueID] to get the value from POST data (because ASP.NET uses that value as control name in the generated html while ClientID is used as html id).

See W3C documentation that describes the form submission - check 17.13.2 & 17.13.3.

0

精彩评论

暂无评论...
验证码 换一张
取 消