S
sck10
Hello,
I am trying to programically make the following TemplateField ("MyTemplate")
visible when the user clicks on the "Edit" Button using the PreRender handle
event. My question is, how do you reference the properties of a particular
TemplateField? For example:
Protected Sub dvDetail_PreRender(ByVal sender As Object, ByVal e As
EventArgs) Handles dvDetail.PreRender
If Me.dvDetail.CurrentMode = DetailsViewMode.Edit Then
MyTemplate.Visible = True
End If
End Sub
<asp:TemplateField
Visible="false"
HeaderText="Activity Date">
<ItemTemplate>
<asp:Label ID="lblActivityDate" Text='<%# Eval("ActivityDate",
"{0:d}") %>' Runat="Server"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtActivityDate" Text='<%# Bind("ActivityDate",
"{0:d}") %>' Runat="Server" />
</EditItemTemplate>
</asp:TemplateField>
I am trying to programically make the following TemplateField ("MyTemplate")
visible when the user clicks on the "Edit" Button using the PreRender handle
event. My question is, how do you reference the properties of a particular
TemplateField? For example:
Protected Sub dvDetail_PreRender(ByVal sender As Object, ByVal e As
EventArgs) Handles dvDetail.PreRender
If Me.dvDetail.CurrentMode = DetailsViewMode.Edit Then
MyTemplate.Visible = True
End If
End Sub
<asp:TemplateField
Visible="false"
HeaderText="Activity Date">
<ItemTemplate>
<asp:Label ID="lblActivityDate" Text='<%# Eval("ActivityDate",
"{0:d}") %>' Runat="Server"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtActivityDate" Text='<%# Bind("ActivityDate",
"{0:d}") %>' Runat="Server" />
</EditItemTemplate>
</asp:TemplateField>