By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,658 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,658 IT Pros & Developers. It's quick & easy.

TemplateColumn & Sorting ( Does not fire the event)

P: n/a
Hi. I have a TemplateColumn with sorting. However, it does not fire the
sort event. Here is what I have. Please help.

<asp:TemplateColumn HeaderText="Wire ID"
SortExpression="WireID">
<itemtemplate>
<a href='<%# "Wire.aspx" + "?PackageID=" +
Request.QueryString["PackageID"] + "&WireID=" +
DataBinder.Eval(Container.DataItem, "WireID") + "&AgentID=" +
DataBinder.Eval(Container.DataItem, "AgentID") + "&CustomerType=" +
DataBinder.Eval(Container.DataItem, "CustomerType") %>'>
<%# DataBinder.Eval(Container.DataItem, "WireID") %>
</a>
</itemtemplate>
</asp:TemplateColumn>

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

In the code behind,

private void InitializeComponent()
{
//this.lnkWireID = new LinkButton();
//this.lnkWireID.ID = "lnkWireID";

this.btnInclude.Click += new System.EventHandler(this.btnInclude_Click);
this.btnApprove.Click += new System.EventHandler(this.btnApprove_Click);
this.CustomerType.SelectedIndexChanged += new
System.EventHandler(this.CustomerType_SelectedInde xChanged);
this.DataGrid1.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEvent Handler(this.SortData);
this.Load += new System.EventHandler(this.Page_Load);

}

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

private void SortData(Object sender, DataGridSortCommandEventArgs e)
{
Session["SortColumn"] = (string) e.SortExpression;
string sSortOrder = (string) Session["SortOrder"];

if (sSortOrder == " desc")
Session["SortOrder"] = " asc";
else
Session["SortOrder"] = " desc";

BindData();
}

Thanks
Jack

--
Be Cool!
Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.