Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
268 views
hi dear telerik team :
i want to copy a textbox text property to another when typing (should be exactly the same)...
so please see the below codes (copy and paste and Test them) :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="keyup.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 runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <style type="text/css">
        fieldset
        {
            width:300px;
        }
        legend
        {
            color:Blue;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <fieldset>
            <legend>keyup</legend>
            <asp:TextBox ID="TextBox1" runat="server" onkeyup="onkeyup_TextBox1();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>keydown</legend>
            <asp:TextBox ID="TextBox3" runat="server" onkeydown="onkeydown_TextBox3();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>keypress</legend>
            <asp:TextBox ID="TextBox5" runat="server" onkeypress="onkeypress_TextBox5();"></asp:TextBox>
            <br />
            <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
        </fieldset>
        <br />
        <br />
        <fieldset>
            <legend>Telerik - keyup</legend>
            <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" DataType="System.Int32"
                onkeyup="onkeyup_RadNumericTextBox1();">
                <NumberFormat DecimalDigits="0" />
            </telerik:RadNumericTextBox>
            <br />
            <telerik:RadNumericTextBox ID="RadNumericTextBox2" runat="server"
                DataType="System.Int32" Culture="fa-IR" Width="125px">
                <NumberFormat DecimalDigits="0" />
            </telerik:RadNumericTextBox>
        </fieldset>
    </div>
        <script type="text/javascript">
            function onkeyup_TextBox1() {
                $('#TextBox2').val($('#TextBox1').val());
            }
            function onkeydown_TextBox3() {
                $('#TextBox4').val($('#TextBox3').val());
            }
            function onkeypress_TextBox5() {
                $('#TextBox6').val($('#TextBox5').val());
            }
            function onkeyup_RadNumericTextBox1() {
                var RadNumericTextBox1 = $find("<%= RadNumericTextBox1.ClientID %>");
                var RadNumericTextBox2 = $find("<%= RadNumericTextBox2.ClientID %>");
 
                RadNumericTextBox2.set_value(RadNumericTextBox1.get_value());
            }
    </script>
    </form>
</body>
</html>


for my purpose onkeyup event on regular asp.net textbox controls is ok...
but it does n't work sometimes in telerik input controls!(there is no problem about onkeyup syntax , just when typing in first text box the other one have 1 character less , why ?)

which event should i use for telerik input controls for doing this job?

thanks in advance

Majid Darab
Top achievements
Rank 1
 answered on 20 Jul 2011
2 answers
68 views
Could you please show some examples of creating a context menu from server side code?

Thanks
Kate
Telerik team
 answered on 20 Jul 2011
1 answer
90 views
Hi Dear
I have project and use rad grid & menu to this project and work well.
but after publish project on windows 2003 server and run in IIS, I can log in and use project
and redirect the other page when i click in radmenu items don't navigate to other page
and go to Default page.

Thanks.

Peter
Telerik team
 answered on 20 Jul 2011
6 answers
88 views
Hi,
I’m using the Rad schedular in one of my pages. I'm using the advancedEditForm with no templates. I have one extra customized attribute called location. The problem I’m have is happening during editing an appointment or insert new one specifically when I click on the combos for "startdate", "starttime", "enddate" or "endtime" I get the following JavaScript error "Error: 'iframeShim.style' is null or not an object" when i debug the error i find it is happening in the following line "b.iframeShim.style.top=(RadHelperUtils.IsDefined(c))?(c+"px"):b.style.top; " within the ScriptResource.axd file
I can't undertand why is this error hapening. The telerik dll version I'm using is 2010.1.519.35. Could you pleae helpmeon this matter.
Thanks,
Nasiem
Peter
Telerik team
 answered on 20 Jul 2011
2 answers
196 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
146 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
65 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
79 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
59 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
333 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?