A
AM
The following block of code defines a FormView control "FormView1" with
an EditItemTemplate which has a Label and a TextBox control within it.
While the Label "RequestIDLabel1" has one-way data-binding to the
underlying column "RequestID", the TextBox "RequestDateTextBox" has
two-way data-binding to the underlying column.
If I were to generate the EditItemTemplate dynamically at runtime, and
add the Label and TextBox controls at run-time, how can I establish the
two-way data-binding between the "RequestDateTextBox" and the
"RequestDate" column?
Any help will be appreciated. Thanks.
<asp:FormView ID="FormView1" runat="server"
DataKeyNames="RequestID" DataSourceID="SqlDataSource1">
<EditItemTemplate>
RequestID:
<asp:Label ID="RequestIDLabel1" runat="server"
Text='<%# Eval("RequestID") %>'></asp:Label><br />
RequestDate:
<asp:TextBox ID="RequestDateTextBox" runat="server"
Text='<%# Bind("RequestDate") %>'>
</asp:TextBox><br />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsEMO70ConnectionString %>"
SelectCommand="SELECT [RequestID], [RequestDate], [RequestDesc],
[PeopleAffected] FROM [SR]"
OldValuesParameterFormatString="original_{0}">
</asp:SqlDataSource>
an EditItemTemplate which has a Label and a TextBox control within it.
While the Label "RequestIDLabel1" has one-way data-binding to the
underlying column "RequestID", the TextBox "RequestDateTextBox" has
two-way data-binding to the underlying column.
If I were to generate the EditItemTemplate dynamically at runtime, and
add the Label and TextBox controls at run-time, how can I establish the
two-way data-binding between the "RequestDateTextBox" and the
"RequestDate" column?
Any help will be appreciated. Thanks.
<asp:FormView ID="FormView1" runat="server"
DataKeyNames="RequestID" DataSourceID="SqlDataSource1">
<EditItemTemplate>
RequestID:
<asp:Label ID="RequestIDLabel1" runat="server"
Text='<%# Eval("RequestID") %>'></asp:Label><br />
RequestDate:
<asp:TextBox ID="RequestDateTextBox" runat="server"
Text='<%# Bind("RequestDate") %>'>
</asp:TextBox><br />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsEMO70ConnectionString %>"
SelectCommand="SELECT [RequestID], [RequestDate], [RequestDesc],
[PeopleAffected] FROM [SR]"
OldValuesParameterFormatString="original_{0}">
</asp:SqlDataSource>