How to get html control in server side
OK this is the most important issues that we get while programming ,,,when we want to use the html controls and also need to call them at server side . So check it out how we do it......
The design part:
<TABLE>
<tr style='color: #FF3300; text-decoration:
underline'>
<td><input width='200px' id="HTMLTEXT1" name="HTMLTEXT1" type='text' />
TEST HTML TEXT1
</td>
<td>
<input
width='200px' id="HTMLTEXT2" name="HTMLTEXT2" type='text'
/>
TEST HTML TEXT2
</td>
<td><input
width='50px' id="HTMLTEXT2" name='HTMLTEXT3" type='text' />
TEST HTML TEXT2
</td>
</tr>
</TABLE>;
Here we have taken three html text box and provided them with "ID" AND "NAME" attribute.
this NAME attribute will be used to take the value in the server side control.
SERVER SIDE CODE BEHIND:
Now We will create three variables and store the values of the HTML text box using REQUEST OBJECT.
string
first_textvalue= this.Request.Form.Get("HTMLTEXT1");
string second_textvalue= this.Request.Form.Get("HTMLTEXT2");
string third_textvalue= this.Request.Form.Get("HTMLTEXT3");
No comments :
Post a Comment