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

OnDemand Datadinding

2 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 2
Tim asked on 26 May 2011, 06:41 PM
Project background:
C# ASP.NET project using a custom class to completely define the RadGrid definition. I am using advanced databinding and ajax.

So far everything I have implemented is working fine. One of the requirements I have is that the user upon entry to the form will select an item from dropdownlist control and then click a button to fetch the datasource based on their selection. This is done because the available selections do not return the same data elements. After the retrieval of the data I am not able to get the grid to display the data. I have  added to following to the onClick event of the button. I am using mock data at this time so __getData = true; signifies I want to return data rather than an empty grid. The .Rebind Method is executing NeedDataSource and the DataTable returned from PolicyAPI.GetPolicyData(__getData) has data but the grid does not seem to reload. I have checked all of the samples but have not found any direction. I appreciate any assistance.

protected void Page_Init(object source, EventArgs e)
{
    this.__policyRadGrid = PolicyRadGrid.GridDefinition();
    this.PlaceHolder1.Controls.Add(this.__policyRadGrid);
}

protected void Page_Load(object sender, EventArgs e)
{
    this.__policyRadGrid.NeedDataSource += new GridNeedDataSourceEventHandler(PolicyRadGrid_NeedDataSource);
}

protected void btnRetrieveData_OnClick(object sender, EventArgs e)
{
    __getData = true;
  this.__policyRadGrid.Rebind();
}
  
protected void PolicyRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
  this.__policyRadGrid.DataSource = PolicyAPI.GetPolicyData(__getData);
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 28 May 2011, 02:57 PM
Hello Tim,

You mentioned that you are using AJAX. If you are using a RadAjaxManager to ajaxify the controls, you should have a setting where the dropdown control updates the RadGrid and another one where the grid updates itself. Make sure that you have these added and let us know if the issue persists.

All the best,
Tsvetina
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.

0
Tim
Top achievements
Rank 2
answered on 31 May 2011, 09:45 PM
Thanks Tsvetina, that took care of the problem.
Tags
Grid
Asked by
Tim
Top achievements
Rank 2
Answers by
Tsvetina
Telerik team
Tim
Top achievements
Rank 2
Share this question
or