Solved

Changing the value of an HTML element through C# code

Posted on 2011-09-23
2
157 Views
Last Modified: 2012-06-21
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
Comment
Question by:dshrenik
2 Comments
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 500 total points
ID: 36591372
You can not do this. You need to set the values only through javascript
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36591960
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now