I have a DetailsView control with a template field as follows:
<asp:TemplateField SortExpression="Title">
<ItemTemplate>
<asp:TextBox ID="txtMessageTitle" Text='<%# Bind("Title") %>' runat="server">
</asp:TextBox>
<asp:Button ID="btnUpdateTitle" runat="server" Text="Update"
CommandName="UpdateTitle" CommandArgument='<%# Bind("MessageID") %>' oncommand="btnUpdateCommand"/>
</ItemTemplate>
</asp:TemplateField>
Detailed view wrapped inside UpdatePanel.
When the user clicks on btnUpdateButton, I would like to get the value of the text field ( txtMessageTitle) in the code behind and use the CommandArgument button to update the corresponding MessageTitle in the database. How to get the value of a text field inside a DetailsView control from the Command event of my button? Thank.
source
share