I m using asp 2.0, I need an requirement for sorting the repeater control. I search over the Internet but i could nt find the correct solution. If anyone knows the answer please
Finally i got the Sorting output in Repeater Control.
1.Maintaining the Static Variable;
static int count = 0;
2.In LinkButton click Event
protected void lnkreq_name_click(object sender, EventArgs e)
{
count=Convert.ToInt32(ViewState["count"].ToString());
ViewState["count"] = count;
loadRepeater("REQUEST_NAME",count);
}
3.call the Function
protected void loadRepeater(string reqname,int count)
{
//write the code to bind into Dataset
DataView dv = ds.Tables[0].DefaultView;
if (count == 0)
{
dv.Sort = reqname + " asc";
ViewState["count"] = 1;
}
else if (count == 1)
{
dv.Sort = reqname + " desc";
ViewState["count"] = 0;
}
//then bind into repeater
}
4.In Repeater
Request Name
<%# Eval("REQUEST_NAME")%>