Rfer to HTML form elements

  • Thread starter Thread starter Samuel Shulman
  • Start date Start date
S

Samuel Shulman

I would like to refer to HTML elements from my ASP.NET code do they have to
be server side

If yes then I can I set their html name for the POST method

Thank you,
Samuel
 
If you're posting to an ASP.Net page, you can access any form variable
passed to it using the Request.Form["fieldname"] collection (where fieldname
is the name of the html form fields name).
 
I want to fill the initial values of the fields before the server sends the
page to the user (in the load event of the form)

Thanks
Samuel


Mark Fitzpatrick said:
If you're posting to an ASP.Net page, you can access any form variable
passed to it using the Request.Form["fieldname"] collection (where
fieldname is the name of the html form fields name).

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

Samuel Shulman said:
I would like to refer to HTML elements from my ASP.NET code do they have
to be server side

If yes then I can I set their html name for the POST method

Thank you,
Samuel
 
Then you would need to make references to them in the code-behind and set
their value attributes. All ASP.Net webform elements should have a
complementary HTMLForm elements. For example, an ASP.Net textbox equivalent
in HTML form is a System.Web.UI.HtmlControls.HtmlInputText.

To access it in codebehind you would assign it as a variable as so.
protected System.Web.UI.HtmlControls.HtmlInputText myfile = new
HtmlInputText;

You'll need to assign the runat="server" attribute for the Html form element
in order for it to work properly.


--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

Samuel Shulman said:
I want to fill the initial values of the fields before the server sends the
page to the user (in the load event of the form)

Thanks
Samuel


Mark Fitzpatrick said:
If you're posting to an ASP.Net page, you can access any form variable
passed to it using the Request.Form["fieldname"] collection (where
fieldname is the name of the html form fields name).

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

Samuel Shulman said:
I would like to refer to HTML elements from my ASP.NET code do they have
to be server side

If yes then I can I set their html name for the POST method

Thank you,
Samuel
 
Back
Top