How to set the HTML form element value in ASP.NET code behind page?

Posted by Bhavna81 under ASP.NET on 10/16/2009 | Views : 4562 | Status : [Member] | Replies : 2
hello,
i have used <input type="text" name="name" id="name"/> tag in my asp.net application. because of some reason i can't use runat="server". i get the value of html textbox in asp.net code behind using the statment

string str = Page.Request.Form["txtPCC"].ToString();

now i want to set the value of input with some string.... how can i ????

please reply..
thanks.




Responses

Posted by: Niradhip on: 10/16/2009 [Member] Starter

Up
0
Down
Use javascript function to set the value for textbox.

Bhavna81, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Virendradugar on: 10/17/2009 [Member] [MVP] Silver

Up
0
Down
Hi,

You can register a javascript from your asp.net code, which will set the value of your input text box.

You can use Page.RegisterStartUpScript() method to call a java script function from your code behind and the java script function will set the value of the input.


Hope this helps!!!

Thanks,
Virendra Dugar

Bhavna81, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response