get value from html

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey,
i have a value that i get from the user using form - (javaScript code) .
now i want to write it on file,
how can i do it ? (asp. C#) ?
thanks
yaniv
 
What is your particular problem? Getting the value to the server side?
Writing a file?

Eliyahu
 
i know how to write string into file c# but i don't know how to recive the
value from the html into the ASP (get the value ti the server side i guess..)

Yaniv
 
What html element on the form is used for getting the user input?

Eliyahu
 
i'm using input field like this:

<form id="frmSubmitForm" name="frmSubmitForm" action="Class1.aspx"
method="post">
<p><input id="btnSubmit" name="btnSubmit" type="button" value="Submit"
onclick="SubmitXML()"></p>
<input type="hidden" id="txtSubmitText" name="txtSubmitText">
</form>
 
Yaniv,

All you need to do is to add runat="server" to the input:

<input type="hidden" id="txtSubmitText" runat="server" name="txtSubmitText">

The name attribute is not really needed.

If you are with Visual Studio 2003, you will need to switch from HTML to
Design view and the VS will generate a reference to txtSubmitText in the
code-behind file. Alternatively you can add a reference yourself as

protected System.Web.UI.HtmlControls.HtmlInputHidden txtSubmitText;

In VS2005 you don't need any references in code-behind/

Eliyahu
 

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

Back
Top