[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


vb.net detailsview change data before update

Posted on 2008-11-07
Medium Priority
Last Modified: 2012-05-05
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">
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem Selected="True">No</asp:ListItem>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("fldCloseDate", "{0:dd/MM/yyyy}") %>'></asp:Label>
Question by:iepaul
1 Comment
LVL 83

Accepted Solution

CodeCruiser earned 2000 total points
ID: 22920033
Create a SelectedIndexChanged event for the dropdownlist2. Set the autopostback property to true. Inside the event, check whether the text in the list is yes or no and set the date accordingly. For example

if dropdownlist2.text="Yes" then
end if

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question