Hi Karine,
Thank you for posting in the community!
Based on my understanding, you use dropdownlist TemplateColumn in your
datagrid control, then you add SelectedIndexChanged event handler, but it
does not fire.
================================================
Actually, I think this problem may occur, if you did not judge the
Page.IsPostBack property, then re-bind the datagrid each postback.
Doing this, your entire datagrid wil be re-filled in each postback, then
the dropdownlist's SelectedIndexChanged event will be lost. To workaround
this problem, you may just do the databinding in the first initial time,
like this:
<asp

ataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 160px; POSITION:
absolute; TOP: 40px"
runat="server" Width="424px" Height="288px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp

ropDownList ID="ddl" Runat="server" AutoPostBack="True"
OnSelectedIndexChanged="SelectedIndexChangedEventHandler">
<asp:ListItem Value="a">a</asp:ListItem>
<asp:ListItem Value="b">b</asp:ListItem>
<asp:ListItem Value="c">c</asp:ListItem>
</asp

ropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp

ataGrid>
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
SqlDataAdapter adapter=new SqlDataAdapter("select * from
jobs","server=localhost;database=pubs;uid=sa;pwd=");
DataSet ds=new DataSet();
adapter.Fill(ds);
}
}
protected void SelectedIndexChangedEventHandler(object sender,
System.EventArgs e)
{
this.Response.Write("abcde");
}
Note: I use Sql Server's default "jobs" table in "pubs" database.
=====================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.