Link to home
Start Free TrialLog in
Avatar of iepaul
iepaulFlag for Ireland

asked on

vb.net detailsview change data before update

I have a detailview showing data from an MS SQL 2000 table.  It shows fldtaskname, fldstartdate, and fldclosedate.  In edit mode I have put a dropdown list with the values Yes and No.  If the user selects Yes I want to put todays date in the fldCloseDate, if they select No I want to leave the field unchanged.

How do I intercept the update and convert Yes to todays date, or convert No to null value?

<asp:TemplateField HeaderText="Close" SortExpression="fldCloseDate">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem Selected="True">No</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("fldCloseDate", "{0:dd/MM/yyyy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial