Problem with DropDown in EditItem of Datagrid!

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

Hello!

When you Click Edit of a DataGrid row I, in EditCommand sub, set the right
Index and recnid the DataGrid.

In ItemCreated (of that Bind) I fill a DropDownlist ( buy adressing it with
ItemIndex and FindControl) and set the Selected Value to the Value I want.
So Far everything is Fine, if I debug and step thru the code.. it fills and
the Selected Value is the right value.

But Then when the page shows... the Selected Item is not the Item with the
SelectedValue.. it's the first in the DropDown box.. as if nothing was
selected. But the Dropdownbox is filled with the right stuff, just not
selected with the value I set (and saw in the debug that it was set)

Since this is VB I can't debug the Data Itself so I tried Setting a
breakpoint in EVERY function and Sub I had in the Form and se if the
DropDownlist accidentley resetted somehow somewhere.. but I can't really
find any place where the Selected Value is overwritten or anything---

I have no idea where to look for answers now.. please help!

Best Regards
/Lars
 
They actually tell how to do it here..

http://aspnet.4guysfromrolla.com/articles/080702-1.3.aspx

But It's strange to me that they do it in the HTML and not in ItemCreated..
I guess it has to do in what order things happen... an dI guess ItemCreated
in not the right tiem to set the SelectedIndex..

I got it working though, with their technique...

/Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top