SelectedIndexChanged event of a DopdownList in a Gridview templatecolumn not firing

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!
 
A

aamir

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");
}
 
C

Chuck

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?
 
A

aamir

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!
 
C

Chuck

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top