Telerik Forums
UI for ASP.NET AJAX Forum
10 answers
1.2K+ views
Hi there,

i encountered a (hopefully) small problem when using the radgrid control to display hierarchical self-referencing data.

I have an XML-Datasource that  contains around 1000 items. Each item has 30 attributes. There are 4 levels of hierarchy in the data.
e.g.

Item 1 (ID = 0, PARENT_ID = null)
---> Item 2(ID = 1, PARENT_ID = 0)
--------> Item 3 (ID = 2, PARENT_ID = 1)
...

The RadGrid is configured to use Databinding by the NeedDataSource event and self-referencing (id and id_parent). Where the datasource  property is set to the aforementioned XML-Datasource. As Soon as the XML contains 800 lines or more an InvalidOperationException is thrown:

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.


I have already set the <jsonSerialization maxJsonLength="2147483644" /> value to the maximum and I am pretty sure that the data payload should not reach that value (2 Gb??). Also when I manually instance a System.Web.Script.Serialization.JavaScriptSerializer() it tells me the MaxJsonLength is only 2 MB but as far as I can tell that is by design.

I hope you can provide with some hints on how to proceed in this matter (Switching to a HierarchyLoadMode othern than Client, is unfortunately not an option.

Thank you for you support.

Regards.

---
Edit: Added the hint that I am using self referencing which was previously only contained in the title of the post.
Radoslav
Telerik team
 answered on 21 Dec 2012
2 answers
202 views
Hello,
I have a hierarchic grid. Something like that (I tried to keep only the interesting lines).
                        
<telerik:RadGrid ID="RadGrid1" runat="server">
 
               <MasterTableView AutoGenerateColumns="False"
                                     Name="LEVEL1"
                                     DataKeyNames="SourceID"
                                     CommandItemDisplay="Top"
                                     EditMode="EditForms"
                                     DataSourceID="ObjectDataSource1" >
 
                   <Columns>
                       <telerik:GridBoundColumn UniqueName="SourceID"
                                                       DataField="SourceID"
             ReadOnly="true" />
                   </Columns>
                    
                   <DetailTables>
                       <telerik:GridTableView AutoGenerateColumns="False"
                                                      Name="LEVEL2"
                                                      DataKeyNames="SourceID" 
                                                                                                            runat="server"
                                                      CommandItemDisplay="Top"
                                                      DataSourceID="ObjectDataSource4" >
 
                           <ParentTableRelation>
                               <telerik:GridRelationFields DetailKeyField="SourceID"
                                                                     MasterKeyField="SourceID" />
                           </ParentTableRelation>
 
                           <Columns>
                                   <telerik:GridBoundColumn UniqueName="SourceID"
                                                                       DataField="SourceID"
                                                                       ReadOnly="true" />
                                   <telerik:GridDropDownColumn UniqueName="ElementShortNameID"
                                                                          DataField="ElementID"
                                                                          HeaderText="Element Short Name ID"
                                                                          ReadOnly="false"
                                                                          DropDownControlType="RadComboBox"
                                                                          DataSourceID="ObjectDataSource5"
                                                                          ListTextField="ElementShortNameID"
                                                                          ListValueField="ElementID" />
                           </Columns>
 
                       </telerik:GridTableView>
                   </DetailTables>
 
                   </MasterTableView>
           </telerik:RadGrid>

At first level (MasterTableView), the records have a "data key name" (sourceID)
At second level, the records have also the same data key name (So I have a "grid relation fileds" between the two identifers)
At second level, there is another field (element) with a value provided by a radcombobox.
I want that, in edit mode, the available element values in the radcombobox depend on the sourceID.
See the following object data source:

<asp:ObjectDataSource ID="ObjectDataSource5" runat="server" TypeName="DataAccessLayer.DataSource.ElementDataSource" SelectMethod="GetElementsListBySource" >
                <SelectParameters>
                    <asp:Parameter Name="SourceID" Type="String"></asp:Parameter>
                </SelectParameters>
            </asp:ObjectDataSource>


It works correctly when I am in Edit mode in order to UPDATE a record. The sourceID used seems to be the one of the record.

But, when I enter in edit mode in order to INSERT a new record (via the "Add a record button"), the sourceID parameter, received by the objectdatasource method (GetElementsListBySource) is null. As the record still not exists, no sourceID can't be used.

My question is: How could a get the parent record sourceID to pass it to the objectdatasource method providing my elements ?
I would like, if possible, make that declaratively in the aspx file to keep the same usage of objectdatasource.

Thanks by advance.
Damien



Damien
Top achievements
Rank 1
 answered on 21 Dec 2012
3 answers
133 views
Is it possible to use a UserControl edit form that does an autopostback with a radgrid configured as an update control in the ajax manager? Has anyone done this? I have a sample that works but when the combobox does the autopostback the page does a full postback.
Tsvetoslav
Telerik team
 answered on 21 Dec 2012
1 answer
165 views
Hi,

I have a radgrid as defined below. There is a refresh button in the grid. How to hide the refresh button?

<telerik:RadGrid ID="radgrid1" runat="server" ShowStatusBar="True" ShowFooter="True"
               OnItemCommand="radgrid1_ItemCommand" OnDeleteCommand="radgrid1_DeleteCommand"
               OnInsertCommand="radgrid1_InsertCommand" OnUpdateCommand="radgrid1_UpdateCommand"
               OnNeedDataSource="radgrid1_NeedDataSource" OnItemDataBound="radgrid1_ItemDataBound"                                  OnPreRender="radgrid1_PreRender"   CellSpacing="0" GridLines="None"
    
              <MasterTableView DataKeyNames="ProductNumber" AutoGenerateColumns="false" EditMode="InPlace"
                   CommandItemDisplay="TopAndBottom" CommandItemSettings-AddNewRecordText="Add New Item">

Thanks

jayanthi
Top achievements
Rank 1
 answered on 21 Dec 2012
4 answers
210 views
Hi Guys,

depending on the used browser (IE, FF, Chrome) we sometimes run into a "NullReferenceException" while trying to open a picture to edit. FF & Chrome working almost all time while IE throws an exeption one of 3 times.

Within this forum we found the guess that someting with webResources/seasson state server is the reason of this error (http://www.telerik.com/community/forums/aspnet-ajax/editor/editor-image-manager-refresh-image-save-image-doesn-t-work-very-well.aspx#2187725) - but we can exclude this after a few tests.

This is the exception we run into:

2012.11.20 17:44:30.988 ThreadId=7 Fatal ErrorsHttpModule
UrlQueryString: /v0/Telerik.Web.UI.WebResource.axd?type=iec&pr=c&key=c695498e-de5a-4dbd-9e85-f4a4e40398c0
REMOTE_ADDR: 192.168.1.38
HTTP_USER_AGENT: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
HTTP_REFERER: [...]/Telerik.Web.UI.DialogHandler.aspx?DialogName=ImageEditor&Skin=Default&Title=&doid=ad5a5db1-7982-46bf-90b9-2afeea8662e6&dpptn=
HttpApplication.RecordError => HttpApplication.RaiseOnError => CustomExceptionHttpModule.app_Error
m1.eRelCL.WebSite.Exceptions.CustomExceptionHttpModule.app_Error
 
FatalException
m1.eRelCL.WebSite.Exceptions.CustomException
 
InnerException
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei Telerik.Web.UI.ImageEditor.ImageEditorCacheHandler.SendImage(EditableImage editableImage, HttpContext context, String path, String fileName)
   bei Telerik.Web.UI.ImageEditor.ImageEditorCacheHandler.ProcessRequest(HttpContext context)
   bei Telerik.Web.UI.HandlerRouter.ProcessHandler(String handlerKey, HttpContext context)
   bei Telerik.Web.UI.HandlerRouter.ProcessHandler(HttpContext context)
   bei Telerik.Web.UI.WebResource.ProcessRequest(HttpContext context)
   bei System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   bei System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
After a few investigations we can confirm, that the error does not happen if we run our web application in only one working process (application pool). Normaly four are default. Now - do you know something about problems with the "ImageEditor" and IIS application pool Working processes? This this a known Bug? I've tried the newest Telerik DLL (Q3 2012) but this does not help anything. Best regards, Felix
Felix
Top achievements
Rank 2
 answered on 21 Dec 2012
1 answer
149 views

Hi,

I have Default.aspx page like this ..

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <title>ASP.NET PanelBar Demo - Dynamic Creation</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All"
        EnableRoundedCorners="false" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadButton1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>         
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    <div>
        <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Height="200" ExpandMode="FullExpandedItem">
        </telerik:RadPanelBar>
    </div>
    <telerik:RadButton ID="RadButton1" runat="server"   Text="RadButton">
    </telerik:RadButton>
    
    </form>
</body>
</html>

Default.aspx.vb :

Imports Telerik.Web.UI
 
Partial Class _Default
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
 
        End If
    End Sub
 
    Protected Sub RadButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadButton1.Click
        Dim i As Integer = 0
        If RadPanelBar1.Items.Count = 0 Then
            Do While (i < 5)
                Dim dateItem As New RadPanelItem()
                dateItem.Text = "Test" + i.ToString()
                RadPanelBar1.Items.Add(dateItem)
 
                Dim control As New RadPanelItem()
                Dim Panel1 As New Panel()
                Session("testText") = " Label" + i.ToString()
                Dim myControl As Control = LoadControl("TestUC.ascx")
                Panel1.Controls.Add(myControl)
                control.Controls.Add(Panel1)
                dateItem.Items.Add(control)
 
                i = i + 1
            Loop
        End If
    End Sub
End Class

ASCX :

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="TestUC.ascx.vb" Inherits="TestUC" %>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


ASCX.VB :

Partial Class TestUC
    Inherits System.Web.UI.UserControl
 
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
 
    End Sub
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Label1.Text = Session("testText")
        End If
 
    End Sub
End Class



When I am click on RadButton1 then I am adding 5 times usercontrol dynamically .If RadPanelBar1.Items.Count = 0 ..So I can able to see label value in 5 usercontrols that added in to radpanelbar.

If I click on RadButton1 2nd time then nothing to do becuase 5 time usercontrol added already in to radpanelbar.. that's  why I put condition like this

If RadPanelBar1.Items.Count = 0
' Add user control here..
End If

Above condition causes nothing loaded in to UI.

Working Image here :  https://docs.google.com/open?id=0B2iTYXKyTlBpZU5ZY1J0SV9FaXc

Not Working Image :  https://docs.google.com/open?id=0B2iTYXKyTlBpTmNGdXNQTjJCVGs


Princy
Top achievements
Rank 2
 answered on 21 Dec 2012
15 answers
296 views
Hi, I have a page which uses a RadTapStrip and RadMultiPage object. The tabs and pageviews are created dynamically upon loading of the page. Each tab is set to either a page within my project (e.g. TabPage1.aspx) or to an external URL (e.g. www.google.com). I'm wondering if it's possible to identify when the ContentURL of the RadPageView changes (e.g. the user clicks on a link the navigates it to another URL). Can this history be tracked or saved somewhere as in a cookie or session or something similar?

The goal I'm trying to achieve is to save the current URL of each tab whenever it changes, so that if a full page refresh occurs, the last ContentURL of each tab can be reloaded.

I have read that you can attach an OnLoad event to an Iframe that fires each time the page is loaded, you can then save the current URL in a cookie on the client. However any attempt to re-create this with a dynamically created iFrame or the standard iFrame in the RadMultiPage has failed. Does this approach sound like it's even possible? 
Nencho
Telerik team
 answered on 21 Dec 2012
2 answers
92 views
There's an Xml with programatic definition.
[XmlArray("credentials")]
        [XmlArrayItem("account")]
        public List<CustomData> Accounts
        {
            get;
            set;
        }
 
[Serializable]
    public sealed class CustomData
    {
        [XmlAttribute("CustomerId")]
        public string CustomerId
        {
            get;
            set;
        }
    }

I get:
Customer Id
ALFKI
ANATR
>>>
How can header text be changed?

CUSTOM-HEADER-NAME
ALFKI
ANATR

OnItemDataBound?
OnDataBinding?

Thank you.
Radoslav
Telerik team
 answered on 21 Dec 2012
3 answers
108 views
Is there a way in server side code (vb.net) to go to a specfic row and column in a grid. An example, I have a grid with 20 rows and 10 columns. I would like to go to row 12, column 7 and hi-light that cell without having to iterate through the grid to locate the specfic row/column. Any suggestions would be appreciated.

Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 21 Dec 2012
3 answers
777 views
Hi,

How can I change the background color of the title-bar of radwindow. Hope somebody might have done this before. Please share

Allen
Shinu
Top achievements
Rank 2
 answered on 21 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?