View Single Post
  #8 (permalink)  
Old June 25th, 2006, 12:16 AM
Aaron Edwards Aaron Edwards is offline
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hold on a minute! I just had a revalation! What I want to do is not to SET the dropdown with a value from my dataset. I want to GET the SelectedVAlue FROM my drowpdown so I can put it INTO my dataset!

I think my problem is stemming from the fact that I have the dropdown in an ItemTemplate instead of an EditItemTemplate. Since I literally have a dropdown for the Size column in every single row, I run this code whenever I'm about to re-bind the datagrid:

            'go through gridview and save all sizes to dataset so we don't lose them
            Dim i As Integer = 0
            For Each gvr As GridViewRow In Me.gvCart.Rows
                Dim DDL As DropDownList = CType(gvr.FindControl("ddlSize"), DropDownList)
                Dim selectedItem As ListItem = DDL.SelectedItem
                Dim selectedValue As String = selectedItem.Value
                dsItemsOrdered.Tables(0).Rows(i)("Size") = selectedValue
                i += 1
            Next
            'dsItemsOrdered.AcceptChanges()

(You can see where I remmed out my AcceptChanges method).

Basically I need to manually update the dataset, because it's not happenning automatically.


Reply With Quote