View Single Post
  #1 (permalink)  
Old February 28th, 2006, 07:47 PM
niceFEPF niceFEPF is offline
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem accessing Request.Form with Master Pages

Hello.

If we have a ListBox and a button on a simple ASPX page, after a submit, we can access its value by Request.Form["ListBox"]. This can be done in Page_Load(), or even earlier in InitializeCulture() method.

But when we add Master Pages, and the page with the ListBox and button are now inside a ContentPlaceHolder, acessing Request.Form["ListBox"], after a submit, always returns null.

The parameter is now hidden in:
Request.Form["ctl00$ContentPlaceHolder1$ListBox1"].

Since in InitializeCulture the objects do not exist yet, we cannot do a Request.Form[ListBox.ClientID]. Furthermore, this returns "ctl00_ContentPlaceHolder1_ListBox1" instead of "ctl00$ContentPlaceHolder1$ListBox1" which would not work as well.

Any idea how to access this value without using this unfriendly string?

Thanks
Fred
Reply With Quote