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

RadGrid - SharePoint Postback Events Issues

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 12 May 2011, 02:51 PM
I'm currently using the Telerik Controls for Ajax with SharePoint 2010 to create custom web parts and I'm having an issue with the RadGrid and posting back events.

I am dynamically creating the grid in the CreateChildControls method of the SharePoint Web Part and binding the grid on specific conditions.

Allow Sorting is true:
this.gvDocumentsGrid.AllowSorting = true;

With this event:
this.gvDocumentsGrid.SortCommand += new GridSortCommandEventHandler(gvDocumentsGrid_SortCommand);

I've also tried using the "NeedDataSource" event, but whenever I click on a column header to sort the grid the page does postback but the SortCommand event is never fired and I lose the binding. I also have the RadAjaxManager registered in my masterpage.

What am I do doing wrong? This is extremely frustrating.

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 17 May 2011, 03:31 PM
Hi Michael,

I suspect the problem is due to incorrect ajax settings. You need to add those on the OnLoad event of the web part:

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    AddAjaxSettings();//custom method where your ajax settings should be created.
}

In addition, do make sure to call the EnsureChildControls() method in the OnInit event:
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
 
    EnsureChildControls();
}


If the problem persists, try pasting your complete code-behind using the CODE-FORMATTER tool of the ticket editor. 


Regards,
Tsvetoslav
the Telerik team

Browse the vast support resources we have to jump start 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
Michael
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or