Make RadGrid DataBind after filter

2 posts, 0 answers
  1. Caio
    Caio avatar
    11 posts
    Member since:
    Jul 2013

    Posted 30 Oct 2013 Link to this post

    Hi, all!
    I've an RadGrid.
    After I make filter, no loads this RadGrid. Because my event CarregaGrid() this inside "If(!IsPostBack)".
    I load this RadGrid with SQL, in List (DataSource in my .cs)
    If I call CarregaGrid() outside if (!IsPostBack), I've an error.
    When I load this RadGrid after an filter? Or... When I call CarregaGrid() outside If(!IsPostBack) without error?

    public void CarregaGrid()
            var listaRequest = new Locations().ConsultLocations();
            if (listaRequest != null)
                this.RadGrid1.DataSource = listaRequest;
        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                if (Session["idioma"] == null)
                    string idioma = CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToString();
                    Session["idioma"] = idioma;
                else if (Session["idioma"] != null)
                    string idioma = Session["idioma"].ToString();
                if (Session["idioma"].ToString() == "pt")
                    IdiomaList.SelectedValue = "PORTUGUÊS";
                else if (Session["idioma"].ToString() == "en")
                    IdiomaList.SelectedValue = "ENGLISH";
                else if (Session["idioma"].ToString() == "es")
                    IdiomaList.SelectedValue = "ESPAÑOL";
                RadGrid1.Columns[1].HeaderText = Idioma.RetornaMensagem("location");
                RadGrid1.Columns[2].HeaderText = Idioma.RetornaMensagem("servername");

  2. Eyup
    Eyup avatar
    3322 posts

    Posted 04 Nov 2013 Link to this post

    Hi Caio,

    Please note that using DataBind() is not recommended. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
    Declarative DataSource
    Advanced Data Binding

    Hope this helps. Please make the suggested modification and let us know about the result.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top