G
George
All,
I have created a footer template which I use to add a new entry via
my datagrid. I also have an edit template to allow the user to edit a
row in the grid. My problem is this. The second column of the grid
is a required field. In the edit template and footer template, i have
included a required field validator which is linked to the
corresponding field in appropriate template. The problem is that
after the user selects edit (which has causesvalidation set to false)
makes changes and selects the update button (which has the
causesvalidation property set to true), the required field validator
in the footer template indicates that the textbox in the footer is a
required field.
So, I have tried to disable the required field validator in the
footer during the edits but cannot seem to find a way to get access to
it. I have tried the e.Item.FindControl("xxxx") in many places but is
seems like unless the user is adding the row, I do not have
programmatic access to the fields in the footer template. Any ideas
how to make this work?
Thanks
George
<asp:TemplateColumn HeaderText="Division Code">
<ItemTemplate>
<asp:Label id=lblDivision_Code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id=txtidivision_code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:TextBox>
<asp:RequiredFieldValidator id="rfvidivisioncode"
runat="server" ErrorMessage="Division code is required."
Enabled="False"
ControlToValidate="txtidivision_code">*</asp:RequiredFieldValidator>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox id=txtdivision_code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:TextBox>
<asp:RequiredFieldValidator id="rfvdivisioncode" runat="server"
ErrorMessage="Division code is required."
ControlToValidate="txtdivision_code">*</asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateColumn>
I have created a footer template which I use to add a new entry via
my datagrid. I also have an edit template to allow the user to edit a
row in the grid. My problem is this. The second column of the grid
is a required field. In the edit template and footer template, i have
included a required field validator which is linked to the
corresponding field in appropriate template. The problem is that
after the user selects edit (which has causesvalidation set to false)
makes changes and selects the update button (which has the
causesvalidation property set to true), the required field validator
in the footer template indicates that the textbox in the footer is a
required field.
So, I have tried to disable the required field validator in the
footer during the edits but cannot seem to find a way to get access to
it. I have tried the e.Item.FindControl("xxxx") in many places but is
seems like unless the user is adding the row, I do not have
programmatic access to the fields in the footer template. Any ideas
how to make this work?
Thanks
George
<asp:TemplateColumn HeaderText="Division Code">
<ItemTemplate>
<asp:Label id=lblDivision_Code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id=txtidivision_code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:TextBox>
<asp:RequiredFieldValidator id="rfvidivisioncode"
runat="server" ErrorMessage="Division code is required."
Enabled="False"
ControlToValidate="txtidivision_code">*</asp:RequiredFieldValidator>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox id=txtdivision_code runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Division_Code") %>'>
</asp:TextBox>
<asp:RequiredFieldValidator id="rfvdivisioncode" runat="server"
ErrorMessage="Division code is required."
ControlToValidate="txtdivision_code">*</asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateColumn>