hi

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2911
    New Member
    • Dec 2007
    • 4

    hi

    hi fnds,
    i am devoloping the web page.Here i am using the HTML TextBox. How the textbox value retrieve in aspx.cs file.

    <input id="text2" type="text" style="z-index: 102; left: 423px; position: absolute; top: 388px" name="text2" />.

    how to retrieve the text2 value in my aspx.cs file.

    Plz give the Solution to my Application.
  • navneetkaur
    New Member
    • Sep 2007
    • 45

    #2
    Originally posted by 2911
    hi fnds,
    i am devoloping the web page.Here i am using the HTML TextBox. How the textbox value retrieve in aspx.cs file.

    u just write
    Code:
     variable= TextBox1.text.ToString();
    u just get with text property....

    if u hv some other problem...

    specify it

    Comment

    • ilearneditonline
      Recognized Expert New Member
      • Jul 2007
      • 130

      #3
      Originally posted by navneetkaur
      u just write
      Code:
       variable= TextBox1.text.ToString();
      u just get with text property....

      if u hv some other problem...

      specify it
      Actually, i don't believe this would work as they are using a standard HTML textbox, not an asp:textbox. If they are using standard HTML, then when the form is posted they would need to do a request.

      Code:
      variable = Request.Form["TextBox1"].ToString().Trim(); //c#, vb would be slightly different.
      I would switch to an <asp:textbox> control then you could get the value as you mentioned above. I would also make a modification, since you can count on users adding unwanted whitespace.

      Code:
       variable= TextBox1.text.ToString().Trim();

      Comment

      • kunal pawar
        Contributor
        • Oct 2007
        • 297

        #4
        either Make Input control as Server control Or u can retrieve value from Request Object

        If you want to make control as server control then add attribute runat = "server"

        <input id="text2" type="text" style="z-index: 102; left: 423px; position: absolute; top: 388px" name="text2" runat="server" />.

        So u can access control in .cs file
        Like text2.Text

        Or u can retrieve text box values after Page submit. if ur form methos is Get
        then
        Request.Queryst ring["text2"]
        And if form method is Post then
        Request.Form["text2"]

        Comment

        • jawaharks
          New Member
          • Jan 2008
          • 12

          #5
          hi fnds,
          i am devoloping the web page.Here i am using the HTML TextBox. How the textbox value retrieve in aspx.cs file.

          <input id="text2" type="text" style="z-index: 102; left: 423px; position: absolute; top: 388px" name="text2" />.

          how to retrieve the text2 value in my aspx.cs file.

          Plz give the Solution to my Application.


          Friend,

          you can access the html control in your cs page, only if you specify the attribute runat="server" for your html control. It will work if you give runat.
          have a try......

          Comment

          Working...