Value of an HTML element

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Value of an HTML element

    I have a HTML text box (NOT a TextBox server control) in
    a .aspx page and a button server control. Is it possible
    with ASP.NET to get the value of the HTML text box when I
    click the button? How can I get the value of an HTML
    element from C# on the server?

    Thanks!
    Halo Guest

  2. Similar Questions and Discussions

    1. Handling HTML element events using AxWebBrowser
      Hello, I am trying to hook into the events for HTML textboxes. In particular the onchange event. In the document complete handler I attach a...
    2. HTML::Element->right/->look_down lose, I need to walk the tree
      Consider this HTML::Element dump of a simple HTML page: <html> @0 <head> @0.0 <title> @0.0.0 "HTML::Element test" <body> @0.1 <div> @0.1.0...
    3. How to *modify* text in HTML::Element
      Sorry for the repost, I hit Send too soon. I am using HTML::TreeBuilder to futz with some HTML, and I need to modify the text of some of the...
    4. How to text in HTML::Element
      I am using HTML::TreeBuilder to futz with some HTML, and I need to modify the text of some of the HTML::Elements. But I use can't find an easy way...
    5. [HTML::Element] how to read element by element
      Hello I read the doc about HTML::Element, but I don't find how to read the tree create by parse() element by element. The doc says the tree looks...
  3. #2

    Default Re: Value of an HTML element

    you could add a runat="server" to the input box

    <input type="textbox" runat="server" id="yourinput" />

    instead of bing a WebControls.TextBox it'll be an
    HtmlControls.HtmlInputText

    alternatively, you can always use Request.Form()...

    Karl


    "Halo" <fds@daf.asf> wrote in message
    news:88fe01c3455f$8a07c300$a401280a@phx.gbl...
    > I have a HTML text box (NOT a TextBox server control) in
    > a .aspx page and a button server control. Is it possible
    > with ASP.NET to get the value of the HTML text box when I
    > click the button? How can I get the value of an HTML
    > element from C# on the server?
    >
    > Thanks!

    Karl Seguin Guest

  4. #3

    Default Re: Value of an HTML element

    Set the HTML Textbox's Runat property to"Server". You will then be able to
    access the value from C#


    Ibrahim Malluf

    "Halo" <fds@daf.asf> wrote in message
    news:88fe01c3455f$8a07c300$a401280a@phx.gbl...
    > I have a HTML text box (NOT a TextBox server control) in
    > a .aspx page and a button server control. Is it possible
    > with ASP.NET to get the value of the HTML text box when I
    > click the button? How can I get the value of an HTML
    > element from C# on the server?
    >
    > Thanks!

    IbrahimMalluf Guest

  5. #4

    Default Re: Value of an HTML element

    It is possible to do this, but you need to do a few things. First, set the
    HTML textboxes runat=server. Then, declare the textbox in your code.
    Include the following (as an example in C#):

    using System.Web.UI.HtmlControls;

    Now, inside of your class, you'll need to put something similar to this:

    HtmlInputText myTextBox; // Make sure the name myTextBox is also the
    name attribute of the HTML control

    so your HTML code would look something like this:

    <INPUT type="text" name="myTextBox" runat="server></INPUT>


    "Halo" <fds@daf.asf> wrote in message
    news:88fe01c3455f$8a07c300$a401280a@phx.gbl...
    > I have a HTML text box (NOT a TextBox server control) in
    > a .aspx page and a button server control. Is it possible
    > with ASP.NET to get the value of the HTML text box when I
    > click the button? How can I get the value of an HTML
    > element from C# on the server?
    >
    > Thanks!

    Kenn Ghannon Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139