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

load controls into div or panel

1 Answer 435 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski asked on 26 Oct 2010, 11:36 AM
Hi,
i've got a problem and dont know how to make it. Ive got a master site:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Default.master.cs" Inherits="Gambu.Client.Web.Default" %>
 
<!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>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager" runat="server" />
    <link rel="stylesheet" type="text/css" href="./Styles/Table.css" />
</head>
<body>
    <form id="MainForm" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager  ID="RadAjaxManager" runat="server" EnableHistory="True" />
        <telerik:RadSkinManager ID="RadSkinManager" Runat="server" Skin="Windows7" />
        <telerik:RadFormDecorator ID="RadFormDecorator" runat="server" Skin="Windows7" />
        <asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server">
        </asp:ContentPlaceHolder>
        </form>
</body>
</html>
Default.cs: OnLoad i check if user is logged in, if no than show window with login:
var rWindow = new RadWindow();
rWindow.Title = "Logowanie";
rWindow.NavigateUrl = "Users/Login.aspx";
rWindow.Skin = "Windows7";
rWindow.IconUrl = "--";
rWindow.AutoSize = true;
rWindow.Modal = true;
rWindow.EnableShadow = true;
rWindow.EnableViewState = false;
rWindow.VisibleTitlebar = true;
rWindow.VisibleStatusbar = false;
rWindow.VisibleOnPageLoad = true;
rWindow.ShowContentDuringLoad = false;
rWindow.OnClientClose = "OnClientClose";
rWindow.Behaviors = Telerik.Web.UI.WindowBehaviors.Move;
WindowManager.Windows.Add(rWindow);
After user loggs in, i close the window and an event is fired:
function OnClientClose(oWnd, args) {
        var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
        ajaxManager.ajaxRequest("client");
    }
 it fires in Default.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Gambu.Client.Web.Default1" %>
 
<asp:Content ID="HeadContent" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy" runat="server"></telerik:RadAjaxManagerProxy>
<script type="text/javascript">
    //<![CDATA[
    function OnClientClose(oWnd, args) {
        var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
        ajaxManager.ajaxRequest("client");
    }
    //]]>
</script>
 
<telerik:RadWindowManager ID="WindowManager" runat="server" />
 
<telerik:RadSplitter ID="MainRadSplitter" runat="server" Width="100%" Height="100%" LiveResize="True" Orientation="Horizontal">
    <telerik:RadPane ID="MainTopRadPane" runat="server" Height="30px" Scrolling="None"></telerik:RadPane>
    <telerik:RadPane ID="MainMiddleRadPane" runat="server" Scrolling="None">
        <telerik:RadSplitter ID="MainContentRadSplitter" runat="server" Width="100%" Height="100%" LiveResize="True" Orientation="Vertical">
            <telerik:RadPane ID="MainLeftMenuRadPane" runat="server" MinWidth="200" Width="250px" Scrolling="None">               
                <asp:Panel ID="MainLeftMenuPanel" runat="server"></asp:Panel>
                <div id="test" runat="server"></div>
            </telerik:RadPane>
            <telerik:RadSplitBar ID="MainMiddleRadSplitBar" runat="server" CollapseMode="Forward"></telerik:RadSplitBar>
            <telerik:RadPane ID="MainContentRadPane" runat="server" Scrolling="None">
            </telerik:RadPane>
        </telerik:RadSplitter>
    </telerik:RadPane>
</telerik:RadSplitter>
</asp:Content>
so i got request in:
protected void AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.Alert("test");
            test.InnerHtml = "test";
        }
Alert is working fine, but i cant change any control  on the site, and id like to load into MainLeftMenuPanel a UserControl, not only this, because ill need to load 3 diffrent controls into 3 diffrent panels or divs

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 27 Oct 2010, 02:05 PM
Hello Zbigniew,

The RadAjaxManager control must be configured as an AJAX initiator with the parents of the controls that you want to add set as updated controls. Here is a similar scenario:

http://www.telerik.com/help/aspnet-ajax/ajxshowloadingpaneloninitialpageload.html

All the best,
Dimo
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Ajax
Asked by
Zbigniew Kozłowski
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or