Server Side Controls in ASP.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kerri

    Server Side Controls in ASP.NET

    Hi,

    I have an aspx page with some server side textboxes.

    I have a button onmy page which allows users to add data
    to a database.

    In my onclick event for my button when I try and get teh
    value from the textbox using..

    Dim myString as String = textbox1.text

    ...it is blank.

    When I do a..

    Dim myString = Request.Form("t extbox1")

    ...I get the value the user enetered.

    I have declared my textbox as a control in my codebehind.

    And it is an asp.net textbox.

    Any ideas why this is?

    This is baffling me.

    Kerri.
  • Kevin Spencer

    #2
    Re: Server Side Controls in ASP.NET

    Have you added the "runat=serv er" attribute to the template HTML for the
    text box?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer

    Big Things are made up of
    Lots of Little Things.

    "Kerri" <anonymous@disc ussions.microso ft.com> wrote in message
    news:017401c39c c4$12c55070$a50 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > I have an aspx page with some server side textboxes.
    >
    > I have a button onmy page which allows users to add data
    > to a database.
    >
    > In my onclick event for my button when I try and get teh
    > value from the textbox using..
    >
    > Dim myString as String = textbox1.text
    >
    > ..it is blank.
    >
    > When I do a..
    >
    > Dim myString = Request.Form("t extbox1")
    >
    > ..I get the value the user enetered.
    >
    > I have declared my textbox as a control in my codebehind.
    >
    > And it is an asp.net textbox.
    >
    > Any ideas why this is?
    >
    > This is baffling me.
    >
    > Kerri.[/color]


    Comment

    Working...