Greetings,
First, let me say that by now, I'm extremely frustrated and pissed that this seemingly simple idea is not so seemingly simple.
I have a GridView:
When the gridview goes into edit mode, instead of my textbox being ID'd "txtDue", renamed to "gvPTPs_ctl02_txtDue". Therefore, when I run this:
The Null value is returned. And that makes sense because the ID of the control was changed. Forgive my attitude when I say, if .NET had left my id alone, I don't think we'd have this problem. I thought the whole purpose for IDing a control was so that you could easily reference it?!
Is there a way to easily reference this value that is posted back to the handler?
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws
First, let me say that by now, I'm extremely frustrated and pissed that this seemingly simple idea is not so seemingly simple.
I have a GridView:
Code:
<asp:GridView ID="gvPTPs" runat="server"
AutoGenerateColumns="false"
AutoGenerateEditButton="true"
AlternatingRowStyle-BackColor="#E9E9E9"
DataKeyNames="ptp_rowid"
CellPadding="4">
<columns>
<asp:TemplateField
HeaderText="Due Date">
<itemTemplate>
<%#DataBinder.Eval(Container.DataItem,"Due") %>
</itemTemplate>
<edititemtemplate>
<asp:TextBox ID="txtDue" MaxLength="10" Columns="10" Text='<%# DataBinder.Eval(Container.DataItem, "Due") %>' runat="server" />
</edititemtemplate>
</asp:TemplateField>
...
</asp:GridView>
Code:
Protected Sub gvPTPs_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvPTPs.RowUpdating
Dim txtNewDue As TextBox
txtNewDue = gvPTPs.Rows(e.RowIndex).FindControl("txtDue")
lblError.Text=txtNewDue.Text
...
End Sub
Is there a way to easily reference this value that is posted back to the handler?
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws