Adding Record To Datagrid Using DropDownList Fails

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
 
K

Konstantinos Pantos

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

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

Top