By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,483 Members | 3,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,483 IT Pros & Developers. It's quick & easy.

value from html control to asp.net control through javascript?

P: 11
hi all,

I want to pass the value from a html control(input...text) to asp.net control(textbox). And this should happen...whenever the html control receives a value(don't want to use a button click event). How this can be possible. I don't want to make a html control as sever control(by adding... runat="server").

Regards,

Royal
Jan 21 '08 #1
Share this Question
Share on Google+
7 Replies


acoder
Expert Mod 15k+
P: 16,027
Use the onchange event instead.

What does the ASP.NET control look like (the source code on the client-side)?
Jan 21 '08 #2

P: 11
Use the onchange event instead.

What does the ASP.NET control look like (the source code on the client-side)?
I am using a normal asp.net textbox.

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>

can you let me know how this going to work. I am new to javascript.

Regards,

Royal
Jan 22 '08 #3

acoder
Expert Mod 15k+
P: 16,027
What's the id of the textbox on the client-side? View Source in the browser.
Jan 22 '08 #4

P: 11
What's the id of the textbox on the client-side? View Source in the browser.
Following are the two controls I am using:

<input id="txtdt" type="text" name="caldt"" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

Whenever the html control receives a value the same should be displayed in the asp.net control. I don't want to use "runat= "server" " with the html control and also i don't want to code anything on click of a button.

Regards,

Royal
Jan 22 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Following are the two controls I am using:

<input id="txtdt" type="text" name="caldt"" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

Whenever the html control receives a value the same should be displayed in the asp.net control. I don't want to use "runat= "server" " with the html control and also i don't want to code anything on click of a button.
I know that's what it looks like in ASP.NET, but what does it look like in HTML? If you load the page containing this code and view the source by choosing View Source from the menu or by right-clicking, you will see that the code is different on the client-side.
Jan 22 '08 #6

P: 11
I know that's what it looks like in ASP.NET, but what does it look like in HTML? If you load the page containing this code and view the source by choosing View Source from the menu or by right-clicking, you will see that the code is different on the client-side.
Basically I am putting these controls on a web user control. So you won't be able to see the code on execution.

Royal
Jan 22 '08 #7

acoder
Expert Mod 15k+
P: 16,027
Basically I am putting these controls on a web user control. So you won't be able to see the code on execution.
I'm not sure what you mean by a web user control, but the browser will show the source code on the client-side. View source in the browser - what does it show for the page?
Jan 22 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.