Javascript / C# variable syntax

D

Dale

I have two questions about the passing of "variables" between ASP & Java:

1. I create an ASP "TextBox" control:

<asp:TextBox ID="txtName" Runat="server"></asp:TextBox><br />

I need to be able to set the "text" property of txtName from Javascript


2. I have a standard HTML TextBox:

<input id="txtName" />

I can easily change the value of "txtName" using Java, but can't seem to
do it through ASP/C#


Any help would be greatly appreciated!

Dale
 
G

Guest

For 1.
you set the text to Web server control in javascript by
document.all('txtName').value = 'some text'
OR
document.getElementById('txtName').value = 'some text'

For 2 Q.
add property runat='server' , so u can access in codebehind file.
<input id="txtName" runat='server' />
 
D

Dale

Thank you!

This is my first ASP project - much different than doing Windows
applications in C#/VB... :)

Dale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top