I need help on how I can validate fields within my DetailsView that are not empty on Submit of the page. I know how to validate them *within* the DetailsView, but not how to access specific databound fields on submit of the entire page.
<aspetailsView ID="dvMainContact" runat="server" AutoGenerateRows="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataKeyNames="DistrictCode" DataSourceID="sqlContacts" ForeColor="Black" Height="50px"
Width="611px" Font-Bold="True" OnModeChanged="dvMainContact_ModeChanged">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="fname" HeaderText="Contact First Name" SortExpression="fname">
<HeaderStyle CssClass="tbldata_bold" HorizontalAlign="Right" />
<ItemStyle CssClass="tbldata" HorizontalAlign="Left" />
</asp:BoundField>
<asp:CommandField ShowEditButton="True"/>
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#E0E0E0" Font-Bold="True" ForeColor="White" />
</aspetailsView>
So for instance, I want to be sure the Fname field is not blank when the user goes to submit the form.
Thanks in advance!!
<aspetailsView ID="dvMainContact" runat="server" AutoGenerateRows="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataKeyNames="DistrictCode" DataSourceID="sqlContacts" ForeColor="Black" Height="50px"
Width="611px" Font-Bold="True" OnModeChanged="dvMainContact_ModeChanged">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="fname" HeaderText="Contact First Name" SortExpression="fname">
<HeaderStyle CssClass="tbldata_bold" HorizontalAlign="Right" />
<ItemStyle CssClass="tbldata" HorizontalAlign="Left" />
</asp:BoundField>
<asp:CommandField ShowEditButton="True"/>
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#E0E0E0" Font-Bold="True" ForeColor="White" />
</aspetailsView>
So for instance, I want to be sure the Fname field is not blank when the user goes to submit the form.
Thanks in advance!!