SelectedIndexChanged event of a DopdownList in a Gridview templatecolumn not firing

  • Thread starter Thread starter aamir
  • Start date Start date
A

aamir

Hello, I guess the subject line says it all. I have put Trace.Warn()
in the SelectedIndexChanged event handler, but it does not get listed
when the trace is on for that page. I have AutoPostback = True for
that Dorpdownlist as well. What could be I missing. Any leads will be
helpful.

Thanks in advance!
 
Hi this is the OP.
Here is the code:
//********** ASPX Markup ****************

<asp:GridView ID="gvCRCSearch" runat="server"
AutoGenerateColumns="False" EnableViewState="False"
DataKeyNames="ApplicantID">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="MiddleName" HeaderText="Middle" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:BoundField DataField="DOB" DataFormatString="{0:MM/dd/yyyy}"
HeaderText="DOB" HtmlEncode="False" />
<asp:BoundField DataField="PrimaryPhone" HeaderText="Prim. Phone" /<asp:BoundField DataField="Ethnicity" HeaderText="Ethnicity" />
<asp:BoundField DataField="SubmitDate" DataFormatString="{0:MM/dd/
yyyy}" HeaderText="Submit Date" HtmlEncode="False" />
<asp:TemplateField HeaderText="Hired?">
<ItemTemplate>
<asp:DropDownList ID="ddlHired" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="ddlHired_SelectedIndexChanged" >
<asp:ListItem Value="False">No</asp:ListItem>
<asp:ListItem Value="True">Yes</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

//******** CS code **************
protected void ddlHired_SelectedIndexChanged(object sender, EventArgs
e) {
Trace.Warn("I'm here");
}
 
Hello, I guess the subject line says it all. I have put Trace.Warn()
in the SelectedIndexChanged event handler, but it does not get listed
when the trace is on for that page. I have AutoPostback = True for
that Dorpdownlist as well. What could be I missing. Any leads will be
helpful.

Thanks in advance!

I'm still learning this stuff, but my research lead me to this link:
http://newsgroups.cryer.info/microsoft/public.dotnet.framework.aspnet/200709/27/07092895108.html.

In a nutshell, have you tried to reference the actual method,
HttpContext.Current.Trace.Warn, since it may not be inherited in your
CS code?
 
Chuck, thanks for the input.
Indeed I was using the full hierarchy and tried it both ways.

Luckily my problem is solved. I have taken out the gridview from the
panel it was in.
The panel's visibile property was set to False by default
purposefully. Therefore on the postback the SelectedIndexChanged event
for the gridview did not fire as it was in an "invisible panel".

thanks!
 
Chuck, thanks for the input.
Indeed I was using the full hierarchy and tried it both ways.

Luckily my problem is solved. I have taken out the gridview from the
panel it was in.
The panel's visibile property was set to False by default
purposefully. Therefore on the postback the SelectedIndexChanged event
for the gridview did not fire as it was in an "invisible panel".

thanks!
No probs. I forgot about that aspect myself. lol Thanks for
refreshing my memory.
 
Back
Top