adding item to dropdown within edititemTemplate

J

Jacques Leclerc

I'm trying to insert an item into a dropDownList web control. What makes it
difficult is that the drop down is located within the EditItemTemplate of a
template column within a datgrid. The control only appears when the row of
the grid is being edited (std built in Edit, Update, Cancel feature). Where
in the code behind file do I put the insert code?

Attempting to do the insert within the OnDataBound event did not work.

Any ideas/suggestions as to where the code should be located will be
appreciated.

Thanks

Jacques Leclerc

Here's the code snippet showing how the control is defined in the apsx page.

<asp:TemplateColumn HeaderText="Next Survey<br>Page ID"
ItemStyle-CssClass="DataGridItem" HeaderStyle-CssClass="DataGridHeader">
<ItemTemplate>
<asp:Label Runat="server" ID="lblAnswerNextPage" Text='<%#
Container.DataItem("NextSurveyPageID")%>' />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList Runat="server" ID="ddlAnswerNextPage"
DataValueField="SurveyPageID" DataTextField="PageName" DataSource="<%#
TheSurveyPage.GetPossibleNextPage(miSurveyID,miPageID,miQuestionID) %>" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" ItemStyle-CssClass="DataGridItem"
HeaderStyle-CssClass="DataGridHeader" />
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top