View Single Post
  #9 (permalink)  
Old June 25th, 2006, 01:32 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

Okay, I have this figured out now. And basically, it cannot be solved.

I'm kind of thinking out loud here. Basically, the problem stemmed from the fact that the act of databinding the dropdown erases the selected selectedValue that it once had. Usually, after binding, one would populate it's selectedValue with a value from the datastore, in this case a dataset. But since this dropdown is in an ItemTemplate, rather than an EditItemTemplate, changes in its value are not automatically saved in the underlying dataset.

One guy (http://webthingsconsidered.blogspot....idview-or.html) solves this by only doing the binding if isPostback is not true. This is a great approach for most applications, but in my case the gridView is only populated in the first place in response to a Postback.

If there were some way to determine if a dropdown in a row had already once been databound, or if the row itself were new, that would do the trick, but I don't think there is.

Aaron

Reply With Quote