GridView with Rows Sorted in Priority Order (Ranked)
-
Hi what im askin myself is how i can sort my gridview depending on the rank column in the database? Its Loos like this http://img2.immage.de/09028ecclientpic.jpg I want to move rows up and down in a GridView
modified on Tuesday, February 9, 2010 9:40 AM
-
Hi what im askin myself is how i can sort my gridview depending on the rank column in the database? Its Loos like this http://img2.immage.de/09028ecclientpic.jpg I want to move rows up and down in a GridView
modified on Tuesday, February 9, 2010 9:40 AM
I solved it(;-
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Up")
{
int i = int.Parse((string)e.CommandArgument);
GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i - 1].Values[0].ToString()), i + 1);
GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i].Values[0].ToString()), i);
BindData();
}
else if (e.CommandName == "Down")
{
int i = int.Parse((string)e.CommandArgument);
GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i + 1].Values[0].ToString()), i);
GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i].Values[0].ToString()), i + 1);
BindData();
}
}