U
Uri
Hi,
Remember my data-bound DropDownList embedded in a TemplateColumn
inside a data-bound DataGrid?
<aspataGrid id="grdProducts" runat="server" DataSource="<%#
myPortfolio.Products %>"
AutoGenerateColumns="False" DataKeyField="Id">
<Columns>
<asp:TemplateColumn HeaderText="Vendor">
<ItemTemplate>
<aspropDownList id=ddlVendor runat="server"
DataValueField="Id" DataTextField="Name"
DataSource="<%# BL.Vendor.GetAll() %>"
AutoPostBack="True">
</aspropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
Now I need to assign a specific event handler to handle the
SelectedIndexChanged
event on the DropDownLists in each row of the DataGrid.
When should I do this? I've tried doing in in the Page_Load handler, in the
DataGrid_ItemBound handler and the DataGrid_ItemCreated handler, but my
SelectedIndexChanged event handler is
never triggered.
Can someone point me in the right direction?
Also, I guess that if my DataGrid has 3 items (rows) then there will be 3
different drop down
lists all with the same name - "ddlVendor". Is this a problem and how can
I overcome it?
Thanks in advance!
Uri from Israel
Remember my data-bound DropDownList embedded in a TemplateColumn
inside a data-bound DataGrid?
<aspataGrid id="grdProducts" runat="server" DataSource="<%#
myPortfolio.Products %>"
AutoGenerateColumns="False" DataKeyField="Id">
<Columns>
<asp:TemplateColumn HeaderText="Vendor">
<ItemTemplate>
<aspropDownList id=ddlVendor runat="server"
DataValueField="Id" DataTextField="Name"
DataSource="<%# BL.Vendor.GetAll() %>"
AutoPostBack="True">
</aspropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</aspataGrid>
Now I need to assign a specific event handler to handle the
SelectedIndexChanged
event on the DropDownLists in each row of the DataGrid.
When should I do this? I've tried doing in in the Page_Load handler, in the
DataGrid_ItemBound handler and the DataGrid_ItemCreated handler, but my
SelectedIndexChanged event handler is
never triggered.
Can someone point me in the right direction?
Also, I guess that if my DataGrid has 3 items (rows) then there will be 3
different drop down
lists all with the same name - "ddlVendor". Is this a problem and how can
I overcome it?
Thanks in advance!
Uri from Israel