Updating a textbox from DropDown selection
I have a DataGrid where, in the EditItemTemplate, one of the columns is a DropDownList and the next column is a textbox. I need to update the TextBox.Text when the DropDownList's selected item is changed.
The aspx page is similar to this:
<asp:datagrid id="grid" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Product">
<ItemTemplate><asp:Literal id="ltlProdName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ProductName") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate><asp:DropDownList id="ddlProdName" runat=server AutoPostBack=True OnSelectedIndexChanged="DropDown_SelectedIndexChan ged"><asp:DropDownList>
</EditItemTemplate>
And the aspx.cs page is like this:
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
//*******Need to find the TextBox control from this row of the grid and update its .Text property*******
}
Not sure how to find that TextBox in the proper row of the DataGrid. It doesnt seem to fire the event either, and if I add a handler to the ItemDataBound of the datagrid, it throws an error that I referrence and object without specifying an instance...
Thanks for your help.
kj
|