Solved

Changing the value of an HTML element through C# code

Posted on 2011-09-23
2
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

710 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