OnDemand Datadinding

3 posts, 1 answers
  1. Tim
    Tim avatar
    60 posts
    Member since:
    May 2011

    Posted 26 May 2011 Link to this post

    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. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1874 posts

    Posted 28 May 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tim
    Tim avatar
    60 posts
    Member since:
    May 2011

    Posted 31 May 2011 Link to this post

    Thanks Tsvetina, that took care of the problem.
Back to Top