Validating DetailsView on Submit

Joined
Dec 4, 2008
Messages
1
Reaction score
0
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!!
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top