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

Problem with RadGrid

5 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cristhian
Top achievements
Rank 1
Cristhian asked on 06 Aug 2015, 06:54 PM

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

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Aug 2015, 09:55 AM
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
0
Cristhian
Top achievements
Rank 1
answered on 13 Aug 2015, 07:27 PM

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.

 

0
Eyup
Telerik team
answered on 18 Aug 2015, 10:32 AM
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
0
Cristhian
Top achievements
Rank 1
answered on 18 Aug 2015, 02:30 PM

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

0
Eyup
Telerik team
answered on 19 Aug 2015, 12:02 PM
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
Tags
Grid
Asked by
Cristhian
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Cristhian
Top achievements
Rank 1
Share this question
or