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

How to change ScriptDescriptors order?

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Liu Peng
Top achievements
Rank 1
Liu Peng asked on 18 Jun 2009, 08:16 AM
Hi,

I create a web server control which contains a radGrid and radAjaxManager, in the same time I add some client capabilities to this web server control reference ASP.NET AJAX tutorials: Adding Client Capabilities to a Web Server Control
I add two client properties:
protected virtual IEnumerable<ScriptDescriptor> GetScriptDescriptors() 
        { 
            ScriptControlDescriptor descriptor = new ScriptControlDescriptor("Unigestion.Web.UI.HTMLGrid"this.ClientID); 
            descriptor.AddProperty("gridClientID"this._radGrid.ClientID); 
            descriptor.AddProperty("ajaxManagerClientID"this._radAjaxManager.ClientID); 
 
            return new ScriptDescriptor[] { descriptor }; 
        } 
 

And in the control's client script, I will get RadGrid and RadAjaxManager object:
Unigestion.Web.UI.HTMLGrid.prototype = { 
 
    initialize: function() { 
        this.$grid = $find(this.gridClientID); 
        this.$ajax = $find(this.ajaxManagerClientID); 
    } 

But when open this page, the client object's $grid and $ajax is null, I checked the page's source find that my control's descriptor js codes is before the radGrid and radAjaxManager:
<script type="text/javascript"
//<![CDATA[ 
Sys.Application.initialize(); 
Sys.Application.add_init(function() { 
    $create(Unigestion.Web.UI.HTMLGrid, {"ajaxManagerClientID":"AjaxManager","gridClientID":"innergrid"}, nullnull, $get("radGrid")); 
}); 
Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[{InitControlID : "AjaxManager",UpdatedControls : [{ControlID:"innergrid",PanelID:""}]},{InitControlID : "AjaxManager",UpdatedControls : [{ControlID:"gridmenu",PanelID:""}]},{InitControlID : "innergrid",UpdatedControls : [{ControlID:"innergrid",PanelID:""}]}],"clientEvents":{OnRequestStart:"OnRequestStart",OnResponseEnd:"OnResponseEnd"},"defaultLoadingPanelID":"","enableAJAX":true,"enableHistory":false,"links":[],"styles":[],"uniqueID":"AjaxManager","updatePanelsRenderMode":0}, nullnull, $get("AjaxManager")); 
}); 
Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadGrid, {"ClientID":"innergrid","ClientSettings":{"AllowAutoScrollOnDragDrop":true,"AllowColumnsReorder":true,"ColumnsReorderMethod":1,"ShouldCreateRows":true,"ReorderColumnsOnClient":true,"DataBinding":{},"KeyMappings":{"ExitEditInsertModeKey":27,"UpdateInsertItemKey":13},"Selecting":{"AllowRowSelect":true,"EnableDragToSelectRows":true},"Scrolling":{"AllowScroll":true,"SaveScrollPosition":true,"ScrollHeight":"300px","UseStaticHeaders":true},"Resizing":{"AllowColumnResize":true,"ClipCellContentOnResize":true,"EnableRealTimeResize":true,"ResizeGridOnColumnResize":true},"ClientMessages":{"PagerTooltipFormatString":"Page \u003cstrong\u003e{0}\u003c/strong\u003e of \u003cstrong\u003e{1}\u003c/strong\u003e"},"KeyboardNavigationSettings":{"AllowActiveRowCycle":false,"FocusKey":89}},"Skin":"Unigestion","UniqueID":"innergrid","_activeRowIndex":"","_controlToFocus":"","_currentPageIndex":0,"_editIndexes":"[]","_embeddedSkin":false,"_gridTableViewsData":"[{\"ClientID\":\"innergrid_ctl00\",\"UniqueID\":\"innergrid$ctl00\",\"PageSize\":10,\"PageCount\":1,\"EditMode\":\"EditForms\",\"CurrentPageIndex\":0,\"VirtualItemCount\":0,\"AllowMultiColumnSorting\":false,\"IsItemInserted\":false,\"clientDataKeyNames\":[],\"_dataBindTemplates\":false,\"_selectedItemStyle\":\"\",\"_selectedItemStyleClass\":\"rgSelectedRow\",\"_columnsData\":[{\"UniqueName\":\"515156\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"FilteringColumn\",\"DataFormatString\":\"{0:#,##0.00}\",\"Display\":true},{\"UniqueName\":\"515154\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"FilteringColumn\",\"DataFormatString\":\"{0:#,##0.00}\",\"Display\":true},{\"UniqueName\":\"515153\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"FilteringColumn\",\"DataFormatString\":\"{0:#,##0.00}\",\"Display\":true}]}]","_groupingSettings":{"GroupContinuesFormatString":" Group continues on the next page.","GroupContinuedFormatString":"... group continued from the previous page. ","GroupSplitDisplayFormat":"Showing {0} of {1} items.","GroupSplitFormat":" ({0})","GroupByFieldsSeparator":"; ","CaseSensitive":false,"ExpandTooltip":"Expand group","CollapseTooltip":"Collapse group","UnGroupTooltip":"Drag out of the bar to ungroup","UnGroupButtonTooltip":"Click here to ungroup","ShowUnGroupButton":false,"ViewState":{}},"_masterClientID":"innergrid_ctl00","allowMultiRowSelection":true,"clientStateFieldID":"innergrid_ClientState"}, {"columnSwapped":OnColumnSwapped,"groupCollapsed":OnGroupCollapsed,"groupExpanded":OnGroupExpanded,"rowContextMenu":OnRowContextMenu}, null, $get("innergrid")); 
}); 
//]]> 
</script> 

How to change these descriptors order?

Thanks,
LP


2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 23 Jun 2009, 03:36 PM
Hello Liu,

Please examine the attached sample project which I have created in order to implement the required functionality. Please note that this problem is not related with our controls.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Liu Peng
Top achievements
Rank 1
answered on 24 Jun 2009, 03:58 AM
Hi Georgi,

Thanks for your help, from your sample I find that I should use AddComponentProperty method sets the value of a client property to a component reference.

Regards,
LP



Tags
Grid
Asked by
Liu Peng
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Liu Peng
Top achievements
Rank 1
Share this question
or