RadGrid inside Repeater and DataSource association

2 posts, 0 answers
  1. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 08 Jul 2010 Link to this post

    I'm associating by code a datasource to a grid inside a repeater control:

    protected void Repeater1_PreRender(object sender, EventArgs e)
            foreach (RepeaterItem item in Repeater1.Items)
                //Dinamically generate DataSource and associate it to Repeater Item
                ObjectDataSource ods = new ObjectDataSource();
                ods.ID = "automaticDS";
                ods.TypeName = "MachinaWeb.Services.BO_ConfigurazioneProgramma_Parametro";
                ods.SelectMethod = "getAll";
                ods.UpdateMethod = "updateParametro";
                ods.SelectParameters.Add("_idCultura", DbType.Int64, HiddenFieldIdCultura.Value);
                ods.SelectParameters.Add("_idAzienda", DbType.Int64, HiddenFieldIdAzienda.Value);
                ods.SelectParameters.Add("_idGruppoParametro", DbType.Int64, ((HiddenField)item.FindControl("HiddenFieldIdGruppo")).Value);
                RadGrid radGrid = (RadGrid)item.FindControl("RadGridParametriConfigurazione");
                radGrid.DataSource = ods;

    Pagination and all works correctly. Instead trying an update it seems we have some problems. No error is thrown but i can exit from update only with cancel and in debug I see it does not reach the update function code.. Why? How can I solve this?
  2. Pavlina
    Pavlina avatar
    6165 posts

    Posted 08 Jul 2010 Link to this post

    Hi Archimede,

    Note that simple data-binding through the DataBind() method can be used in simple scenarios which does not require complex operations like insert/delete/update, grouping, hierarchy relations, etc. You may take a look at the following articles on suggested way to populate RadGrid when using CRUD operations:

        - Advanced Data-binding (using NeedDataSource event)
        - Declarative DataSource

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top