how to retrieve data from FormView!

Last post 05-16-2008 12:05 AM by Hua-Jun Li - MSFT. 3 replies.

Sort Posts:

  • how to retrieve data from FormView!

    05-14-2008, 1:35 AM
    • Member
      17 point Member
    • amirzandi
    • Member since 04-08-2008, 9:59 AM
    • Posts 116

    I have a FormView in my page which it is getting information from Database as follows:

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="id"

    DataSourceID="SqlDataSource1">

    <EditItemTemplate>

    id:

    <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>' />

    <br />

    Name:

    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />

     

    I also have a TextBox1 and Button out of this FormView, I want to know that how can I retrieve NameTextBox value when button1 is pressed!?

    I would be thankful if anyone help.

     

  • Re: how to retrieve data from FormView!

    05-14-2008, 2:11 AM
    • Member
      102 point Member
    • fakhre
    • Member since 11-30-2006, 9:41 AM
    • Posts 132

    try to code on update panel of ajax extension if  your website support ajax...

    or send few more details wt u looking for..

     

    thnx 

  • Re: how to retrieve data from FormView!

    05-14-2008, 2:27 AM
    • Member
      17 point Member
    • amirzandi
    • Member since 04-08-2008, 9:59 AM
    • Posts 116

    how you dont understand me?

    I want to get the value of Name in my DataList by pressing a button....

     

    Why AJAX? why database update? I dont want to update it. I just want to get the value of Name in DataList....

  • Re: how to retrieve data from FormView!

    05-16-2008, 12:05 AM
    Answer

    Hi amirzandi,

    You can try the following method.

    string str=((textbox)FormView1.Row.FindControl("NameTextBox")).text

    Let me know if I have misunderstood what you mean.
    Thanks.
    Hope it helps,
    Hua Jun

    Sincerely,
    Hua Jun Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (4 items)