Adding Record To Datagrid Using DropDownList Fails

  • Thread starter Thread starter gary.huntress
  • Start date Start date
G

gary.huntress

I'm trying to add a record to a data grid in a pretty standard
fasion. I have a dropdownlist in my footertemplate:

<FooterTemplate>
<asp:DropDownList runat="server" id="newTitle"
DataValueField="ActiveContentTypeID" DataTextField="Title"
DataSource='<%# GetTitles() %>' />
</FooterTemplate>

And as you can see it is filled via the call to GetTitles(). This is
function returns a collection of items rather than a dataset.

The DropDownList does properly fill. The ItemCommand event handler
is properly called and I do recieve the entire dropdown list in the
handler. However, the selectedIndex is always zero. Not -1 and not
the index of the item I have selected.

I can't track down the reason for this. Any ideas?

Thanks,

Gary
 
Check and make sure that you're not calling DataBind on the DropDownList
before the ItemCommand fires.
HTH
 
Back
Top