Why doesn't this MSDN sample work for me?
I'm trying the code sample (for ASP NET C#, for VS2010) from this page: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
And for anything I do the following line always evaluated to null:
if (Request.Form["ListBox1"] != null开发者_如何学JAVA)
{
}
Can someone explain why?
You are getting null
because you are trying this example in a page that has a master page. If your page has a master page, controls rendered in the client side have a different ID. Since the Request.Form
requires the client Id
to access the value.
精彩评论