Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Changing the value of an HTML element through C# code

I can do the following to change the value of  an HTML textbox from C#:

<input type="text" name="email" id="myTextBox" runat="server" />
myTextBox.Text = "abc";

But, if the HTML controls are created through javascript, and if I have set runat="server", how can I achieve the above?

Basically, I am creating a seeries of textboxes using a for loop in javascript. Now, I want set their values using HTML.

Thanks!
0
dshrenik
Asked:
dshrenik
1 Solution
 
sonawanekiranCommented:
You can not do this. You need to set the values only through javascript
0
 
Ramkisan JagtapLead DeveloperCommented:
In java script you can access your controls using ID of you control.
incase your control myTextbox you can set value as below.

var mytxt=document.getelementById("myTextbox ");
mytxt.value="abc";


Regards,
Ram
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now