Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdownlist in edit mode does not return the right value??

Status
Not open for further replies.

majordog

Programmer
Jul 8, 2002
222
CA
Hey All,

I have an editable column in a datagrid called DG_Combo which I declare like this:

<asp:TemplateColumn HeaderText=&quot;Technician&quot;>
<ItemStyle HorizontalAlign=&quot;Center&quot;></ItemStyle>
<ItemTemplate>
<asp:Label id=lblTechnician Text='<%# DataBinder.Eval(Container.DataItem, &quot;Technician&quot;) %>' Runat=&quot;server&quot;>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat=&quot;server&quot; id=&quot;hdnEquipID&quot; Visible=False Text='<%# DataBinder.Eval(Container.DataItem, &quot;EquipStatID&quot;) %>'/>
<asp:Label ID=&quot;lblTempTechnician&quot; Text='<%# DataBinder.Eval(Container.DataItem, &quot;Technician&quot;) %>' Runat=&quot;server&quot; />
<asp:DropDownList id=&quot;cboTechnician&quot; DataTextField=&quot;Name&quot; DataValueField=&quot;Name&quot; runat=&quot;server&quot; OnSelectedIndexChanged=&quot;PopulateNextCombo&quot; />
</EditItemTemplate>
</asp:TemplateColumn>

On the update command I find the control doing this:
Dim cboTechnician As DropDownList = CType(e.Item.FindControl(&quot;cboTechnician&quot;), DropDownList)

and then find out what the text value of the control is by cboTechnician.SelectedItem.Text

It continues to hold onto the same name no matter how I play with the code. It doesn't capture the correct name even on load - I don't understand what is happening since this code has worked fine in other areas of the app..?? Anyone got any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top