Problem with RadGrid

6 posts, 0 answers
  1. Cristhian
    Cristhian avatar
    3 posts
    Member since:
    Aug 2015

    Posted 06 Aug 2015 Link to this post

    Hi all,

    I have 2 differents ways to create grids in my asp.net page, in aspx and programmatically, so 4 of those grids are programatically because the numbers of columns are dynamic and other 4 has static columns so i defined in aspx.

    There is some incompatibility with this?, the static grids lose the events, i have a delete command an never fires if there is some code in Page_Init event, if i comment that code, the events works,

     

    Thanks

  2. Eyup
    Admin
    Eyup avatar
    3726 posts

    Posted 11 Aug 2015 Link to this post

    Hi Cristhian,

    Generally, there should be no friction between separately created RadGrids. There is the following limitation, however:
    RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file.
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically

    Could you verify that you are not using DataBind() to bind the grid? Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, 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
    Programmatic Data Binding


    Also, you can temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there is script error interfering.


    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. Cristhian
    Cristhian avatar
    3 posts
    Member since:
    Aug 2015

    Posted 13 Aug 2015 in reply to Eyup Link to this post

    Hi Eyup!

    Thanks for your time, i need to explain you something that i found in my code, because i think i get the error but i'm a little confuse about that.

    First that all i create my grid programmatically in the Page_Init but as show you before the others grids lost the events, so i don't get the answer with your reply, so i decide to find the error in my code, and the problem what i found was related with this line

     If Not Page.FindControl(Page.Request.Params("__EVENTTARGET")) Is Nothing Then
        'SOME CODE
    End If

    ​this code runs in Page_Init code, because i need to change the structure of the grid in a page event, so i need to detect which control trigger the postback, i don't know why but the use the Page.FindControl cause the problems for the grids.

     

  4. Eyup
    Admin
    Eyup avatar
    3726 posts

    Posted 18 Aug 2015 Link to this post

    Hi Cristhian,

    You should include the following condition to prevent null values:
    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        Dim controlID As String = Page.Request.Params("__EVENTTARGET")
        If Not String.IsNullOrEmpty(controlID) Then
            Dim control As Control = Page.FindControl(controlID)
            If Not control Is Nothing Then
                'execute custom logic
            End If
        End If
    End Sub

    You can also use the Request.Form.Get("DropDownList1") approach as demonstrated in the following article:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/changing-the-grid-structure-dynamically-on-postback

    That should do the trick. Please make the suggested modification and let me know about the result.

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  5. Cristhian
    Cristhian avatar
    3 posts
    Member since:
    Aug 2015

    Posted 18 Aug 2015 in reply to Cristhian Link to this post

    Hi Eyup.

     

    whit your last post i get the same behavior, i fix my problem trying to avoid the call "Page.FindControl(controlID)" because it generates the problem.

     

    thanks

  6. Eyup
    Admin
    Eyup avatar
    3726 posts

    Posted 19 Aug 2015 Link to this post

    Hello Cristhian,

    Strange indeed - the suggested snippet was working pretty well on my end. Nevertheless, I'm glad the provided directions have proven helpful for finding the solution on your side. Have in mind that you should disable the EnableColumnsViewState property if you will change the columns structure dynamically, as explained in the article provided in my previous post.

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top