Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
202 views
Is it possible that I export multiple radgrid to multiple excel worksheets? I have for example radGrid1, radGrid2, radGrid3 and I want after export have 3 worksheets in one *.xls file. Please help.

Thanks.
sebastian
Top achievements
Rank 1
 answered on 20 Jul 2011
4 answers
151 views
When using a built-in skin the command icons (edit, delete, etc.) are automatically pulled properly through the WebResource.axd handler.

However, when you change your skin to a custom skin, it just starts using URLs like "delete.gif" and "edit.gif" which of course do not exist in the folder of the user control that contains the grid.

What is the CORRECT way to update the skin so that the command icons are properly displayed based on the images located in the skin's folder?

Thanks,
Kevin
Gail
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
67 views
Hi,

This occurs in your guys' demo, as well as in my application. In the demo it seems to be slightly more broken, but nevertheless:

http://demos.telerik.com/aspnet-ajax/dock/examples/autopostback/defaultcs.aspx

If you grab one of those dock's by its title bar and pull it to the RHS of your monitor -- the dock starts pulling the page wider and wider. I would like to restrict dragging to the browser's view port.

How would I go about doing this?

Thanks

Sean
Pero
Telerik team
 answered on 20 Jul 2011
1 answer
84 views
I´m having problem to handle drag docks from dockzones that are not in same content placeholder.
Anyone that could help me out?

Markup:
<%@ Page Title="" Language="C#" MasterPageFile="~/App_master/SiteTwoColumn.master"
    AutoEventWireup="true" CodeFile="EditPageSiteTwoColumn.aspx.cs" Inherits="EditPageSiteTwoColumn" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="SideBar" runat="Server">
 
    <telerik:RadDockLayout runat="server" ID="RadDockLayout2" Skin="Clear" EnableEmbeddedSkins="false">
        <telerik:RadDockZone runat="server" ID="RadDockZone2" MinHeight="200">
        </telerik:RadDockZone>
    </telerik:RadDockLayout>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <table style="width: 100%;">
        <tr>
            <td style="width: 140px">
                Select Module:
            </td>
            <td style="width: 140px">
                <asp:DropDownList runat="server" ID="DroptDownWidget" Width="150">
                    <asp:ListItem Text="Blogg.ascx" Value="~/UserControls/Blogg/Blogg.ascx"></asp:ListItem>
                    <asp:ListItem Text="Footer.ascx" Value="~/UserControls/Footer/Footer.ascx"></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
            </td>
            <td style="width: 100px">
                <asp:Button runat="server" ID="ButtonPostBack" Text="Make PostBack" OnClick="ButtonPostBack_Click" />
            </td>
        </tr>
        <tr>
            <td>
                Select Docking Zone:
            </td>
            <td>
                <asp:DropDownList ID="DropDownZone" runat="server" DataSource="<%#GetZones() %>"
                    DataTextField="ID" DataValueField="ClientID" Width="150">
                </asp:DropDownList>
            </td>
            <td>
                <asp:Button runat="server" ID="ButtonAddDock" Text="Add Dock (AJAX)" OnClick="ButtonAddDock_Click" />
            </td>
            <td>
                <asp:Button runat="server" ID="ButtonClear" Text="Clear Dock State" OnClick="ButtonClear_Click" />
            </td>
        </tr>
    </table>
    <asp:UpdatePanel runat="server" ID="UpdatePanel2" ChildrenAsTriggers="false" UpdateMode="Conditional">
        <ContentTemplate>
            <br />
            <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnSaveDockLayout="RadDockLayout1_SaveDockLayout"
                OnLoadDockLayout="RadDockLayout1_LoadDockLayout" Skin="Clear" EnableEmbeddedSkins="false">
                <telerik:RadDockZone runat="server" ID="RadDockZone1" Width="591" MinHeight="200">
                </telerik:RadDockZone>
            </telerik:RadDockLayout>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ButtonAddDock" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <div style="width: 0px; height: 0px; overflow: hidden; position: absolute; left: -10000px;">
        Hidden UpdatePanel, which is used to help with saving state when minimizing, moving
        and closing docks. This way the docks state is saved faster (no need to update the
        docking zones).
        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        </asp:UpdatePanel>
    </div>
</asp:Content>

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
public partial class EditPageSiteTwoColumn : System.Web.UI.Page
{
    private bool _dockStateCleared = false;
    private List<DockState> CurrentDockStates
    {
        get
        {
            //Store the info about the added docks in the session. For real life
            // applications we recommend using database or other storage medium
            // for persisting this information.
            List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesMyPortal"];
            if (Object.Equals(_currentDockStates, null))
            {
                _currentDockStates = new List<DockState>();
                Session["CurrentDockStatesMyPortal"] = _currentDockStates;
            }
            return _currentDockStates;
        }
        set
        {
            Session["CurrentDockStatesMyPortal"] = value;
        }
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownZone.DataBind();
        }
    }
 
    public ArrayList GetZones()
    {
        ArrayList zones = new ArrayList();
        zones.Add(RadDockZone1);
        return zones;
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        //Recreate the docks in order to ensure their proper operation
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
            if (CurrentDockStates[i].Closed == false)
            {
                RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
                //We will just add the RadDock control to the RadDockLayout.
                // You could use any other control for that purpose, just ensure
                // that it is inside the RadDockLayout control.
                // The RadDockLayout control will automatically move the RadDock
                // controls to their corresponding zone in the LoadDockLayout
                // event (see below).
                RadDockLayout1.Controls.Add(dock);
                //We want to save the dock state every time a dock is moved.
                CreateSaveStateTrigger(dock);
                //Load the selected widget
                LoadWidget(dock);
            }
        }
    }
 
    protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
    {
        //Populate the event args with the state information. The RadDockLayout control
        // will automatically move the docks according that information.
        foreach (DockState state in CurrentDockStates)
        {
            e.Positions[state.UniqueName] = state.DockZoneID;
            e.Indices[state.UniqueName] = state.Index;
        }
    }
 
    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
    {
        if (!_dockStateCleared)
        {
            //Save the dock state in the session. This will enable us
            // to recreate the dock in the next Page_Init.
            CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();
        }
        else
        {
            //the clear state button was clicked, so we refresh the page and start over.
            Response.Redirect(Request.RawUrl, false);
        }
    }
 
    private RadDock CreateRadDockFromState(DockState state)
    {
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Docked;
        dock.ID = string.Format("RadDock{0}", state.UniqueName);
        dock.ApplyState(state);
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        return dock;
    }
 
    private RadDock CreateRadDock()
    {
        int docksCount = CurrentDockStates.Count;
 
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Docked;
        dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
        dock.ID = string.Format("RadDock{0}", dock.UniqueName);
        dock.Title = "Blog module";
        dock.Text = string.Format("Added at {0}", DateTime.Now);
        dock.Width = Unit.Pixel(300);
        dock.Resizable = true;
 
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        return dock;
    }
 
    private void CreateSaveStateTrigger(RadDock dock)
    {
        //Ensure that the RadDock control will initiate postback
        // when its position changes on the client or any of the commands is clicked.
        //Using the trigger we will "ajaxify" that postback.
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack = true;
 
        AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "DockPositionChanged";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
 
        saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "Command";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
    }
 
    private void LoadWidget(RadDock dock)
    {
        if (string.IsNullOrEmpty(dock.Tag))
        {
            return;
        }
        Control widget = LoadControl(dock.Tag);
        dock.ContentContainer.Controls.Add(widget);
    }
 
 
    protected void ButtonAddDock_Click(object sender, EventArgs e)
    {
        RadDock dock = CreateRadDock();
        //find the target zone and add the new dock there
 
        ContentPlaceHolder mainContent = (ContentPlaceHolder)this.Master.FindControl("MainContent");
        RadDockZone dz = (RadDockZone)FindControl(mainContent.FindControl("UpdatePanel2"), "RadDockZone1");
        if (dz != null)
        {
            dz.Controls.Add(dock);
            CreateSaveStateTrigger(dock);
 
            //Load the selected widget in the RadDock control
            dock.Tag = DroptDownWidget.SelectedValue;
            LoadWidget(dock);
 
            //Add RadDockZoneInfo text
 
        }
    }
    protected void ButtonPostBack_Click(object sender, EventArgs e)
    {
        //normal postback
    }
    protected void ButtonClear_Click(object sender, EventArgs e)
    {
 
        //clear docks state from the session
        CurrentDockStates.Clear();
        _dockStateCleared = true;
    }
 
    private Control FindControl(Control firstLevel, string Id)
    {
 
        if (firstLevel.ID == Id)
 
            return firstLevel;
 
        foreach (Control Ctl in firstLevel.Controls)
        {
 
            Control c = FindControl(Ctl, Id);
 
            if (c != null)
 
                return c;
        }
        return null;
    }
}
Pero
Telerik team
 answered on 20 Jul 2011
2 answers
65 views
on clicking the tab
Message: 'this.get_tableElement()' is null or not an object Line: 1292 Char: 1 Code: 0

i put this user control in a sharepoint page layout.

David
Top achievements
Rank 1
 answered on 20 Jul 2011
4 answers
339 views
Dear Telerik-Staff,

my scenario looks as follows:

I have a masterpage containing a radtreeview inside a radpanel. This tree stores information about data assigned to a specific user. In one of my content pages (which is nested in the masterpage) I perform an operation in which the data assigned to the above called user is updated.

When this operation success I want to update the radtreeview on the masterpage. Thus, I did the following:

1.)
In the method which updates the data on the content page, I call

((RadAjaxManager)this.Master.FindControl("AjaxManagerMasterPage")).RaisePostBackEvent("MyCustomCommand");


2.)
On the masterpage, I have an AjaxManager (NOT a proxy!) which registers the AjaxRequest-Event:
OnAjaxRequest="AjaxManagerMasterPage_AjaxRequest"

3.)
In the code behind file of the master page I handle the event:

protected void AjaxManagerMasterPage_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            if (e.Argument == "MyCustomCommand")
            {
                //Just an example
                mainPanelBar.Items[5].Text = DateTime.Now.ToLongTimeString();
            }
        }

4.)
In the markup-file of the masterpage I defined the controls to be ajaxyfied as follows:

<telerik:AjaxSetting AjaxControlID="AjaxManagerMasterPage">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="mainPanelBar" />
                        <telerik:AjaxUpdatedControl ControlID="anotherControl" />
                    </UpdatedControls>
                </telerik:AjaxSetting>

The event fires as expected, but the tree view on the masterpage isn't ajaxified (updated). Somewhere in the docs I read tht the AjaxManager can only ajaxify controls beneath itself and that controls on the masterpage cannot be ajaxified.

To me, it looks much more as if I made a mistake in the definition of the updated controls for the RadAjaxManager. Or isn't it possible to ajaxify a control on the masterpage even if the AjaxRequest (fired in the content page) is raised as expected in the master page? For example, when I call Response.Redirect in the AjaxRequest-Event, the page redirects to the specified URL.

Best regards,
Marco


Marco Beyer
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
143 views
Hi all,

I have a default page which is ajax enabled. From here I open a report.aspx page which is loaded into a radwindow. The report.aspx page is just a grid with data. When I try and export this data I get the error:

"

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation


"

I'm not sure why I'm getting this. Can someone please help me find the solution? Code below: Thanks!

Report.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="quick_transaction_popup.aspx.cs" Inherits="OnTime.OnTime_Reports.Visitors.quick_transaction_popup" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
 
    <telerik:RadScriptManager ID="Report_ScriptManager" runat="server" />
 
            <h3>
                <asp:Literal ID="Literal_View1_Title" runat="server" Text="Transactions: Quick Report - "></asp:Literal>
            </h3>
 
                <asp:PlaceHolder ID="PlaceHolder_Report_SQL" runat="server">
                    <asp:SqlDataSource ID="SqlDataSource_Report" runat="server">
                    </asp:SqlDataSource>
                </asp:PlaceHolder>
 
            <telerik:RadGrid ID="RadGrid_Report" runat="server" AutoGenerateColumns="false"
            AllowMultiRowSelection="false" AllowAutomaticInserts="false"
            GridLines="None" CellPadding="0" AllowSorting="false" Skin="Outlook"
            ItemStyle-VerticalAlign="Top"
            OnExcelMLExportRowCreated="RadGrid_Report_ExcelMLExportRowCreated" Width="100%"
            >
 
                <ExportSettings HideStructureColumns="true" ExportOnlyData="true" FileName="Visitor_TQR" OpenInNewWindow="true"
                 IgnorePaging="true">
                    <Excel Format="ExcelML" />
                </ExportSettings>
 
                <MasterTableView Width="100%" CommandItemDisplay="Top" GridLines="None" AllowAutomaticInserts="false">
 
                <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToWordButton="false" ShowExportToExcelButton="true"
                ShowExportToCsvButton="false" ShowRefreshButton="false"/>
                 
                    <Columns>
 
                         <telerik:GridBoundColumn UniqueName="Report_Logs_DateTime" DataField="Visitor_Logs_DateTime"
                         HeaderText="Time" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                         <telerik:GridBoundColumn UniqueName="Report_Transaction_Type" DataField="Function_Key_Description"
                         HeaderText="Transaction Type" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                         <telerik:GridBoundColumn UniqueName="Report_UserName" DataField="Visitor_UserName"
                         HeaderText="Visitor" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Selecting AllowRowSelect="false" />
                </ClientSettings>
            </telerik:RadGrid>
 
 
     
    </div>
    </form>
</body>
</html>


Report.aspx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            //Register Javascript for Export Buttons
            string script2 = "function onRequestStart(sender, args)" +
                "{" +
                    "if (args.get_eventTarget().indexOf(\"ExportToExcelButton\") >= 0 ||" +
                    "args.get_eventTarget().indexOf(\"ExportToWordButton\") >= 0 ||" +
                    "args.get_eventTarget().indexOf(\"ExportToCsvButton\") >= 0)" +
                "{" +
                    "args.set_enableAjax(false);" +
                "}" +
                "}";
 
            //I've tried commenting and UN-commenting this line with no luck!
            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Report_RadGrid_Ajax_Disable", script2, true);
 
            Display_Report_RadGrid();
 
        }
 
        protected void Display_Report_RadGrid()
        {
 
            //Populate Rad Grid
            SqlDataSource_Report = new SQL_Data_Source().getSQLDataSource();
            SqlDataSource_Report.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
            SqlDataSource_Report.SelectCommand = SQL_Customer_Connection.Product_Name + "_rp_Visitor_TQR";
 
            SqlDataSource_Report.SelectParameters.Add("Param_Customer_ID_Ref", TypeCode.String, (string)Session["User_Belongs_To_Customer_Ref_ID"]);
            SqlDataSource_Report.SelectParameters.Add("Param_Company_ID_Ref", TypeCode.String, (string)Session["User_Belongs_To_Company_Ref_ID"]);
 
            SqlDataSource_Report.SelectParameters.Add("Param_Visitor_Auto_ID_Ref", TypeCode.Int32, "22");
            SqlDataSource_Report.SelectParameters.Add("Param_Transaction_Types", TypeCode.String, "0,1,2,3,4,5,6,7,8");
 
            SqlDataSource_Report.SelectParameters.Add("Param_Start_Date", TypeCode.DateTime, "2011-01-01");
            SqlDataSource_Report.SelectParameters.Add("Param_End_Date", TypeCode.DateTime, "2012-01-01");
 
            RadGrid_Report.DataSource = SqlDataSource_Report;
            RadGrid_Report.Rebind();
        }
 
 
        bool ExcelML_isConfigured = false;
 
        protected void RadGrid_Report_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
        {
            if (e.RowType == GridExportExcelMLRowType.DataRow)
            {
                //Add custom styles to the desired cells
                 
 
                if (!ExcelML_isConfigured)
                {
                    //Set Worksheet name
                    e.Worksheet.Name = "Visitor_TQR";
 
                    //Set Column widths
                    foreach (ColumnElement column in e.Worksheet.Table.Columns)
                    {
                        switch (e.Worksheet.Table.Columns.IndexOf(column))
                        {
                            case 1:
                                column.Width = Unit.Point(100);
                                break;
                            case 2:
                                column.Width = Unit.Point(150);
                                break;
                            case 3:
                                column.Width = Unit.Point(150);
                                break;
                        }
                    }
 
                    //Set Page options
                    PageSetupElement pageSetup = e.Worksheet.WorksheetOptions.PageSetup;
                    pageSetup.PageLayoutElement.IsCenteredVertical = true;
                    pageSetup.PageLayoutElement.IsCenteredHorizontal = true;
                    pageSetup.PageMarginsElement.Left = 0.5;
                    pageSetup.PageMarginsElement.Top = 0.5;
                    pageSetup.PageMarginsElement.Right = 0.5;
                    pageSetup.PageMarginsElement.Bottom = 0.5;
                    //pageSetup.PageLayoutElement.PageOrientation = PageOrientationType.Landscape;
 
                    //Freeze panes
                    e.Worksheet.WorksheetOptions.AllowFreezePanes = true;
                    e.Worksheet.WorksheetOptions.LeftColumnRightPaneNumber = 1;
                    e.Worksheet.WorksheetOptions.TopRowBottomPaneNumber = 1;
                    e.Worksheet.WorksheetOptions.SplitHorizontalOffset = 1;
                    e.Worksheet.WorksheetOptions.SplitVerticalOffest = 1;
 
                    e.Worksheet.WorksheetOptions.ActivePane = 2;
                    ExcelML_isConfigured = true;
                }
            }
        }
Marin Bratanov
Telerik team
 answered on 20 Jul 2011
4 answers
104 views
I've noticed that if you set PreventCollapse to true, that the control still shows the expand icon. I know you can hide it using CSS, which is what I've done, but I think it would make more sense to hide it when the control is set to not collapse because it's suggesting an action that cannot be performed.

Is there a reason for it not hiding the expand icon or did you guys overlook this issue?

Thanks.
Nikolay Tsenkov
Telerik team
 answered on 20 Jul 2011
1 answer
98 views
I have RadComboBox in my page, i want bind the database table with my RadComboBox .. But Here i don't want to bind it in page_Load, Which event i need to have for binding RadComboBox..

Please Suggest me..
Shinu
Top achievements
Rank 2
 answered on 20 Jul 2011
3 answers
145 views
Hi,

I am trying to 'move' a postback event from a RadListBox to a RadDockZone. My reasoning for this is that the user is drag-and-dropping an item onto the screen. The 'interesting' object is where the item is being dropped, not where it came from. As such, I am trying to stop the postback on the listbox and move it to the dockzone dropped upon.

function OnClientDropping(sender, eventArgs) {
    eventArgs.set_cancel(true);
    sender.clearSelection();
    var droppedID = eventArgs.get_htmlElement().id;
    var listBoxID = sender.get_id();
    var sourceItem = eventArgs.get_sourceItem();
    var sourceItemText = sourceItem.get_text();
    var sourceItemValue = sourceItem.get_value();
    $find(ajaxManagerID).ajaxRequestWithTarget(droppedID, "Test");
}

I cancel the dropping event from the radlistbox, and then attempting to move the request to the dockzone.

Now, I have overriden Page's RaisePostBackEvent to ensure that the event is indeed posting. It is, and it has the UniqueID of the dockZone. Nevertheless, I do not see the RaisePostBackEvent event firing on my RadDockZone (I have my own class of RadDockZone which implements IPostBackEventHandler). Any thoughts on why? I haven't wired up an event to it (could use a suggestion as to which is best), but was just trying to make sure it got there.

EDIT: So I've gone about this a different way. I'm still not entirely happy with my implementation, so I would love to hear Telerik's input, but here is what I've got:

Client-Side Javascript Necessary:

function OnClientDropping(sender, eventArgs) {
    eventArgs.set_cancel(true);
    sender.clearSelection();
    previousZone = null;
 
    var sourceItem = eventArgs.get_sourceItem();
    var droppedID = eventArgs.get_htmlElement().id;
 
    if (droppedID.indexOf("RadDockZone") != -1) {
        if ($find(droppedID).get_docks().length == 0) {
            dockZoneDroppedOnID = droppedID;
 
            var eventData = {};
            eventData["sourceItemText"] = sourceItem.get_text();
            eventData["sourceItemValue"] = sourceItem.get_value();
            eventData["listBoxID"] = sender.get_id();
 
            $find(ajaxManagerID).ajaxRequestWithTarget(droppedID, $.toJSON(eventData));
        }
    }
    else {
        dockZoneDroppedOnID = "";
    }
}
 
var dockZoneDroppedOnID = "";
//Handles drawing the LoadingPanels over the correct elements when callbacks are occurring.
var loadingPanel = "";
var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
var postBackElement = "";
pageRequestManager.add_initializeRequest(initializeRequest);
pageRequestManager.add_endRequest(endRequest);
 
function initializeRequest(sender, eventArgs) {
    loadingPanel = $find(radAjaxLoadingPanel1ID);
    postBackElement = eventArgs.get_postBackElement().id;
    //When drag and dropping the 'interesting' control isn't where we're coming from but where we're going to.
    if (dockZoneDroppedOnID != "") {
        postBackElement = $find(dockZoneDroppedOnID).get_parent().get_id(); ;
        dockZoneDroppedOnID = "";
    }
    loadingPanel.show(postBackElement);
}
 
function endRequest(sender, eventArgs) {
    loadingPanel = $find(radAjaxLoadingPanel1ID);
    loadingPanel.hide(postBackElement);
}

Server-Side Code:

protected void Page_Load(object sender, EventArgs e)
{
    Logger.Info("Page Load");
    RegenerationManager.Instance.RegenerateDockContents();
 
    if (IsPostBack)
    {
        string eventTarget = Request.Params.Get("__EVENTTARGET");
 
        if (eventTarget.Contains("DockZone"))
        {
            CreationManager.ProcessDragAndDrop(eventTarget, Request.Params.Get("__EVENTARGUMENT"));
        }
    }
}

From here, I detect that an event was targeting my DockZone.

The structure of my controls is like so:

<cc1:CormantRadPane ID="RadPane1" Runat="server">
    <nStuff:StyledUpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional" CssClass="maxHeight" >
        <ContentTemplate>
            <cc1:CormantRadSplitter ID="RadSplitter1" runat="server" Visible="false"/>
            <cc1:CormantRadDockZone ID="RadDockZone1" runat="server" />
       </ContentTemplate>
    </nStuff:StyledUpdatePanel>
</cc1:CormantRadPane>

CreationManager handles the processing of the JSON I passed back, and adds a dock to the dockZone. Since I targeted the dockZone with the update, the UpdatePanel wrapping the dockZone refreshes the area and everything seems to work pretty well.

I'm not so keen on how I parse out the information. Would love a suggestion on how to do it better -- I thought I could do it by implementing IPostBackEventHandler in my class which inherits from RadDockZone, but I have been unsuccessful so far.

EDIT2: Mission....SUCCESSFUL!

To all who are trying to do this: (This is a lot more relevant if you're working underneath a master page)

RadControls expose the client-side method .get_id(). This method returns (at least for me!) the ClientID of the object. In creating my controls I do not set the ClientID, however, so it may act differently if you have.

It is structured something like this: "ctl00_MainContent_RadDock_GUIDHERE"

This is NOT the uniqueID of the control, but it is close. In order for the PostBackEvent of a WebControl to respond it needs to match the unique ID of the control.

I did so like this:

var splitterClientID = pane.get_splitter().get_id();
var indexOfID = splitterClientID.indexOf("RadSplitter");
var uniqueID = splitterClientID.substr(0, indexOfID).replace(/_/g, "$");
var splitterID = splitterClientID.substr(indexOfID);

USEFUL ID: uniqueID.concat(splitterID) -- this rebuilds our old string with underscores replaced
with cash symbols, but will NOT replace any undescores following the control ID declaration.
e.g. saying ctl00_MainContent_RadSplitter_ABC will transform into ctl00$MainContent$RadSplitter_ABC

After making this change I was able to successfully implement IPostBackEventHandler.

Telerik: It'd be sweet if you could expose a client-side method that returns the uniqueID of the control. It is really difficult to get a handle on this for DYNAMICALLY created controls. It is easier when all the controls are known -- you can just use "<%= MyControl.UniqueID %>" but this isn't an acceptable solution for all implementations..

Thanks,

Sean
Pero
Telerik team
 answered on 20 Jul 2011
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?