This is a migrated thread and some comments may be shown as answers.

Dynamic Radgrid Refresh issue

1 Answer 202 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 02 Dec 2010, 09:46 PM
Hi,

I am using Master/Content page in my system. The content page is aspx which calls user control.
The user control creates the dynamic template column and binds to the grid. There is a asp link button called "log" in one of the columns in the grid and when I click the button, it inserts record into the db and disables the link button, so that user can not click the button again. I got the log button disabled but the grid is not refreshing the updated data.
I have used AjaxManagerproxy in my ascx. I call the binding of the grid inside gridview_NeedDataSource.

The following code is in Page_PreRender.

if (IsPostBack)
{
if (Session["isLog"] != null && Session["isLog"].ToString() == "true")
{
//gridview.DataSource = new string[] { };
//gridview.DataSource = null;
this.BindGrid();
//gridview.Rebind();
Session["isLog"] = "";
}

The grid binds the data twice when I tried clearing the grid by using "gridview.DataSource = null;", just before binding the grid.

The grid does not display any data if I use "gridview.DataSource = new string[] { };" just before binding the grid.

Can you please help me in fixing the Refresh inside the grid?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 07 Dec 2010, 03:29 PM
Hello Priya,

Consider using advanced RadGrid databinding through the NeedDataSource event. With this approach, you can pass RadGrid's data source only once in NeedDataSource and call Rebind() anywhere you need. Additionally Rebind() should be called only when RadGrid's data source changes or some other action is performed requiring rebinding. RadGrid binds automatically when needed otherwise.

Veli
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Priya
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or