How do I add code to a dropdownlist's selected index changed event When the DDL is inside of a detailsView control ?

Hi;
I want to add today's date to a row of a detailsView control when the selected index changed event fires for a dropdownlist, which is located in the the same detailsView

All this happens in the detailView.Updating event so that is where I am trying to write my code.

This is what I want to do:

So far I know that 1) Place code in detailsview1.rowupdating event .

                               2) Make a row copy, not sure about the syntax here

           Dim aRow As DetailsViewRow = Me.DetailsView1.Rows(DetailsView1.Rows.Item(?))

                  3) Find my DDL

                Dim aDDL as dropdownlist = CType(aDDL.cells(?).Findcontrol("Dropdownlist3"0, dropdownlist)

                 If aDLL.selected IndexChanged then

                 Dim aTextbox as textbox = Ctype(detaislview.cells(?).findcontrol("Textbox6", textbox6)

                  aTextbox.text =   now()    

    I tried this code i.e. stepped through it and the value of the textbox changed in the locals windows but it did not change in the table column for the record that I was updating.

Is my problem caused by my having my code in the wrong event ? detailView.Updating .
If so what event should I use ?

     Thanks

gggoddardAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gggoddardConnect With a Mentor Author Commented:
Hi;
I answered my own question.
I tried another detailView event
Like So:

Protected Sub DetailsView1_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles DetailsView1.ItemCommand
If e.CommandName = "Update" Then
Dim aDDL As DropDownList = DetailsView1.FindControl("dropdownlist3")
If aDDL.SelectedIndex > 0 Then
Dim aTextBox = DetailsView1.FindControl("textbox5")
aTextBox.text = Now().ToString
End If
End If
End Sub

 
Thanks
 
0
 
informaniacCommented:
I think u should try doing it in the ItemCommand event.
0
All Courses

From novice to tech pro — start learning today.