Catch TextBox value entered by user into the GridView Templated Field (both created dynamically) on

Discussion in 'ASP .Net Datagrid Control' started by Tatyana, Jun 26, 2006.

  1. Tatyana

    Tatyana Guest

    Hello,



    I was wondering if anybody knows how to get the values entered by the user
    into the GridView Templated Field (both created dynamically) which is a
    textbox.

    Usually it could be



    <asp:TextBox id="textbox1" OnTextChanged="TextBoxTextChanged" runat="server"
    />



    and then

    protected void TextBoxTextChanged(object sender, EventArgs e)

    {TextBox txt_b = (TextBox)sender;

    NewText = txt_b.Text;}

    The reason that it didn't work is because we have multiple gridviews created
    dynamically in code-behind, along with Templated Fields one of them is a
    TextBox.

    I'm trying to get entered by user data on the PostBack. But I either get the
    same text pre-populated on gridviews creation (if I don't check on the
    postback) or I'm getting a null for GridView (if I check on PostBack and do
    not create all controls again on postback).

    I was able to Add the OnTextChanged="TextBoxTextChanged" Attribute to the
    TextBox. When text changes on submit button click event is not working.

    Thank you,

    Tatyana
     
    Tatyana, Jun 26, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page