Getting the value of asp.net control using Request.Form
you have an asp textbox with the id as txtBox and the button as btnSubmit ,
now you enter the text as “Sample” in the textbox, on click of submit, in order to get the value of the textbox .
you need to put the name in the Request.Form, like Request.Form["txtBox"], now if you have a master page and the content page has the above controls, then you will have id as for ex: ctl300_ContainerName_controlId and the name as ctl300$ContainerName$controlId,
now in order to get the value, you need to specify as follows
Request.Form[ctl300$ContainerName$controlId] which is the name of control and not Request.Form[ctl300_ContainerName_controlId] which is the id of control.
Thanks!
Posted: July 3rd, 2008 under Uncategorized.
Tags: asp.net