DropDownList SelectedIndexChanged event not firing within GridView HeaderTemplate?

Up vote 1 down vote favorite share g+ share fb share tw.

Good morning, I am having a very annoying problem; my situation is that I am working on a job board website and specifically the job search page at the moment. I am returning the jobs found into a DataBound GridView (namely gvwJobs), and within the HeaderTemplate I have a DropDownList named ddlSortDirection which specifies the direction in which the sorting is performed: DOWN UP As you can see, I have ensured that AutoPostBack is on. I have also created a custom event handler on the GridView's DataBound event as so: Protected Sub gvwJobs_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.

GridViewRowEventArgs) Handles gvwJobs. RowDataBound If e.Row. RowType = DataControlRowType.

Header Then ddlSortDirection. AutoPostBack = True AddHandler ddlSortDirection. SelectedIndexChanged, AddressOf ddlSortDirection_SelectedIndexChanged End If End Sub I am finding that the ddlSortDirection_SelectedIndexChanged SubProcedure is not called when the selection is changed in ddlSortDirection.

I can see that a PostBack occurs, but the method is definitely not called. What I have tried doing is creating a similar DropDownList outside of the GridView and that successfully triggered the SelectedIndexChanged event without even having a custom event handler! Please could you help me to achieve my goal of having a DropDownList firing the SelectedIndexChanged event when within a HeaderTemplate of a GridView!

Kind Regards, Adam Sharif gridview dropdownlist selectedindexchanged not-firing link|improve this question asked Jan 21 '10 at 12:36Adam Sharif612.

Please see the link below asimsajjad.blogspot.com/2009/09/raising-... Hope that will help.

1, cause (as far as I can tell) the link does actually provide a good, working example and can be used to find the answer. Don't think the downvote was called for. – Remi Despres-Smyth Aug 11 '11 at 18:50.

Set the EnableViewState of that GridView to false.

There are some similar questions (see Event handler not firing using AddHandler and Assign an event to a custom control inside a Repeater control ), but your particular case looks like you're adding the handler twice; once in the markup, and once on databound.

You say AutoPostBack is set to true but I don't see it in the markup and by default it's set to false. So try.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions