Hi,
we are using 2013 Q1 Radgrid.
I came to know that Radgrid doesn't have clientside sorting unless it is done through webservice call etc. Only other option is to enable sorting on server side. In sort command event, help link suggest to rebind the grid. My situation is like this:
I bind the grid in page load event when it is not a postback like this:
{
bindgrid(txtbox1.text, dropdownlist1.selectedvalue);
}
}
private void bindgrid(string txtvalue, string ddlvalue)
{
radgrid1.DataSource = customobject; //data retrieved as custom object from databased using those parameters
radgrid1.DataBind();
}
Based on certain conditions some columns are shown/hide in ItemDataBound event. On the page, there are many other controls along with Radgrid. User can select different choices of these controls (like different data, different list item from dropdown etc) and click on another button called refresh. In this button click event we are binding grid again with different parameter values.
We have a button called 'ShowStatus'. When this button is clicked, status column (which is hidden initially) should be shown. we loop thru all the rows and get key values (as xml) and send to database and get back status for each item as xml. Then again we loop thru rows and assign status to each row status cell.
This is working fine and when 'ShowStatus' button is clicked, status column is showing up with data.
{
// setting status column to be displayed
// loop thru grid items and set status column to appropriate status coming from database as xml.
we are using 2013 Q1 Radgrid.
I came to know that Radgrid doesn't have clientside sorting unless it is done through webservice call etc. Only other option is to enable sorting on server side. In sort command event, help link suggest to rebind the grid. My situation is like this:
I bind the grid in page load event when it is not a postback like this:
protected
void Page_Load(....)
{
if (!IsPostBack)
{
//bind radgrid
bindgrid(txtbox1.text, dropdownlist1.selectedvalue);
}
}
private void bindgrid(string txtvalue, string ddlvalue)
{
radgrid1.DataSource = customobject; //data retrieved as custom object from databased using those parameters
radgrid1.DataBind();
}
Based on certain conditions some columns are shown/hide in ItemDataBound event. On the page, there are many other controls along with Radgrid. User can select different choices of these controls (like different data, different list item from dropdown etc) and click on another button called refresh. In this button click event we are binding grid again with different parameter values.
We have a button called 'ShowStatus'. When this button is clicked, status column (which is hidden initially) should be shown. we loop thru all the rows and get key values (as xml) and send to database and get back status for each item as xml. Then again we loop thru rows and assign status to each row status cell.
This is working fine and when 'ShowStatus' button is clicked, status column is showing up with data.
protected
void btnShowStatus_Click(object sender, EventArgs e)
{
// setting status column to be displayed
// loop thru grid items and set status column to appropriate status coming from database as xml.
}
The problem is after this, if user clicks on one of the columns to sort, I am not sure what to do in sort command event. According to help, I need to bind the grid again. If I call bindgrid routine, I lose how it was before. I need the grid to display as it was before (before postback) with sorted data. How can I restore grid.
I appreciate your response.
Thanks,
Prathiba.