Validating DetailsView on Submit

Dec 4, 2008
Reaction score
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" />
<asp:BoundField DataField="fname" HeaderText="Contact First Name" SortExpression="fname">
<HeaderStyle CssClass="tbldata_bold" HorizontalAlign="Right" />
<ItemStyle CssClass="tbldata" HorizontalAlign="Left" />
<asp:CommandField ShowEditButton="True"/>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#E0E0E0" Font-Bold="True" ForeColor="White" />

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!!


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question