Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i try to get the textbox value in edit mode return null what is the problem

XML
<asp:FormView ID="fvAdminPro" runat="server" OnModeChanging="fvAdminPro_ModeChanging" Height="277px" OnItemUpdated="fvAdminPro_ItemUpdated" OnItemUpdating="fvAdminPro_ItemUpdating" OnPageIndexChanging="fvAdminPro_PageIndexChanging" Width="88px">

<EditItemTemplate>

  <asp:TextBox ID="fNametxt" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
    </EditItemTemplate>
    </asp:FormView>


    code behinde


     protected void fvAdminPro_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {



            string test = ((TextBox)(fvAdminPro.Row.FindControl("fNametxt"))).Text;

             //test always return null
            }
Posted

1 solution

From what I saw on MSDN:

The text box is still updating. The ItemUpdating event allows you to make changes before they are committed after the event.

Try looking at the e.NewValues dictionary.

Source:
DetailsViewUpdateEventArgs.NewValues Property[^]
 
Share this answer
 
Comments
TheSniper105 17-Apr-15 13:42pm    
how to access newValue of each textBox ??
Andy Lanng 17-Apr-15 14:00pm    
e.NewValues["fNametxt"] i think

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900