Search code examples
c#asp.netlinqteleriklinqdatasource

How to regenerate grid data on various button click event of a page while we are using telerik grid with LinqDataSource


I am using Telerik grid control and LinqDataSource control on a page.

code :

<asp:LinqDataSource ID="ldsFillGridData" runat="server" OnSelecting="ldsFillGridData_Selecting" />

all things working fine now i want to call its

protected void ldsFillGridData_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
    e.Result = from tc in db.city select tc;
}

this selecting event calling from some button click event. How???

I am trying like

ldsFillGridData_Selecting(null, null);

but it throws an error.

How to regenerate grid data on various button click event of a page while we are using telerik grid with LinqDataSource?


Solution

  • Just use Rebind() function of this telerik grid control, it will automatically calls ldsFillGridData_Selecting event and it shows updated records in Grid.

    RadGrid.rebind();