I work on the website of the working group and, in particular, the job search page at the moment. I return the tasks found in DataBound GridView(namely gvwJobs), and inside HeaderTemplateI have DropDownListwith a name ddlSortDirectionthat determines the direction in which the sort is performed:
<asp:DropDownList runat="server" ID="ddlSortDirection" AutoPostBack="true" OnSelectedIndexChanged="ddlSortDirection_SelectedIndexChanged">
<asp:ListItem Value="DESC">DOWN</asp:ListItem>
<asp:ListItem Value="ASC">UP</asp:ListItem>
</asp:DropDownList>
As you can see, I made sure that it is AutoPostBackturned on. I also created a special event handler in the event GridView DataBoundlike this:
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
, ddlSortDirection_SelectedIndexChanged , ddlSortDirection. , a PostBack, . , , DropDownList GridView SelectedIndexChanged, !
, : DropDownList SelectedIndexChanged, HeaderTemplate GridView?