Main menu:

 

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Site search

Archives

Categories

Tags

Links:

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!

Write a comment





Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page.