Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
174 views
Hi,
I have tried to use the codes are for validation in Asyncupload and uplod tools in these links:
http://demos.telerik.com/aspnet-ajax/upload/examples/async/validation/defaultcs.aspx?product=asyncupload
http://www.telerik.com/help/aspnet-ajax/upload-client-side-validation.html

But none of them works correcrtly! when I select a non-valid file (for example a pdf file which its extension is changed to jpg), it does not prevent uploading it.

this is all my code with Asyncupload:
<asp:Content ID="Content2" ContentPlaceHolderID="content2" Runat="Server">
<script type="text/javascript">
      //<![CDATA[
        function validationFailed(sender, eventArgs) {
            $(".ErrorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
        }
      //]]>
    </script>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.Core.js">
            </asp:ScriptReference>
 
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQuery.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
<telerik:RadButton ID="uploadbtn" runat="server" Text="upload"
        onclick="uploadbtn_Click">
    </telerik:RadButton>
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server"
        AllowedFileExtensions="jpg,jpeg"
        TargetFolder="~/upload" OnClientValidationFailed="validationFailed"
        onfileuploaded="RadAsyncUpload1_FileUploaded" >
        <FileFilters>
        <telerik:FileFilter Description="Images(jpeg;jpg)" Extensions="jpeg,jpg" />
    </FileFilters>
    </telerik:RadAsyncUpload>

and in code behind for upload button:
protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
    {
        Label fileName = new Label();
        fileName.Text = e.File.FileName;
 
 
        if (e.IsValid)
        {
            Response.Write(fileName + "::true");
        }
        else
        {
            Response.Write("false");
        }
    }
 Is there anything missing from me?
Plamen
Telerik team
 answered on 04 Jul 2012
6 answers
160 views
Hi,
    When in week view the VisibleRangeStart date shows as a Monday (24/10/2011) which is expected but the VisibleRangeEnd also shows as a Monday (31/10/2011) which I would expect it to show as a Sunday (30/10/2011). I have only tried this in the latest 2011 Q2 SP1 build so I'm not sure if this is by design or a bug. I have FirstDayOfWeek set to Monday and LastDayOfWeek set to Sunday.

The screen shows Monday - Sunday so can not understand why VisibleRangeEnd property would be different.

Is this a bug or do I have my setings wrong?
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="100%" Height="100%"
    OnDataBound="RadScheduler1_DataBound" AppointmentStyleMode="Default" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
    OnNavigationComplete="RadScheduler1_OnNavigationComplete" OnClientFormCreated="schedulerFormCreated"
    CustomAttributeNames="AppointmentColor" StartInsertingInAdvancedForm="true" EnableDescriptionField="true"
    DayView-EnableExactTimeRendering="True" ShowFooter="False" GroupBy="Room" DayEndTime="21:00:00"
    WorkDayEndTime="21:00:00" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" Culture="en-GB"
    DayView-HeaderDateFormat="dddd, MMMM dd, yyyy">
    <AdvancedForm Modal="true" />
    <Reminders Enabled="true" />
    <AppointmentTemplate>
        <div class="rsAptSubject">
            <%# Eval("Subject") %>
        </div>
        <%# Eval("Description") %>
    </AppointmentTemplate>
    <AdvancedEditTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
            Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>'
            AppointmentColor='<%# Bind("AppointmentColor") %>' UserID='<%# Bind("User") %>'
            RoomID='<%# Bind("Room") %>' />
    </AdvancedEditTemplate>
    <AdvancedInsertTemplate>
        <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
            Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>'
            AppointmentColor='<%# Bind("AppointmentColor") %>' UserID='<%# Bind("User") %>'
            RoomID='<%# Bind("Room") %>' />
    </AdvancedInsertTemplate>
    <TimelineView UserSelectable="false" />
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <DayView EnableExactTimeRendering="True"></DayView>
    <AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>
Peter
Telerik team
 answered on 04 Jul 2012
2 answers
120 views
Hello,
I`m using RadMenu, my custom skin.

Schema is: ImageUrl (image A), HoveredImage(image B), SelectedImage(image B). Unfortunately SelectedImage property won`t work. I was looking solution, couldn`t find.

<telerik:RadMenu ID="RadMenu1" runat="server" EnableEmbeddedSkins="False"
                      Skin="MyOwn"
                      EnableTextHTMLEncoding="True">
                      <Items>
                          <telerik:RadMenuItem runat="server" HoveredImageUrl="~/gfx/home_hover.png"
                              ImageUrl="~/gfx/home.png"
                              NavigateUrl="~/About.aspx"
                              SelectedImageUrl="~/gfx/home_hover.png">
                          </telerik:RadMenuItem>
                      </Items>
                  </telerik:RadMenu>
Marcin
Top achievements
Rank 1
 answered on 04 Jul 2012
1 answer
137 views
I have a radgrid

<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True" AllowSorting="True"
     PageSize="25" AllowAutomaticUpdates="True" AllowMultiRowEdit="False" AutoGenerateColumns="False"
     AllowPaging="True" DataSourceID="DataSource1" OnItemUpdated="RadGrid1_ItemUpdated"
     AllowFilteringByColumn="True" OnItemDeleted="RadGrid1_ItemDeleted"
     OnDataBound="RadGrid1_DataBound">
     <PagerStyle Mode="NextPrevAndNumeric"  Position="TopAndBottom" PageSizeLabelText="Rows Per Page:" />
     <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataSourceID="DataSource1" EditMode="InPlace" UseAllDataFields="True">
         <Columns>
             <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                 <ItemStyle CssClass="MyImageButton" />
             </telerik:GridEditCommandColumn>
             <telerik:GridBoundColumn    DataField="InstallCount"
                                         HeaderText="Install Count"
                                         SortExpression="InstallCount"
                                         UniqueName="InstallCount"
                                         ReadOnly="True">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn    DataField="PackageName"
                                         HeaderText="Package Name"
                                         SortExpression="PackageName"
                                         UniqueName="PackageName"
                                         ReadOnly="True">
             </telerik:GridBoundColumn>
             <telerik:GridDropDownColumn DataField="ToBeTestedID"
                                         DataSourceID="SqlDataSource3"  
                                         HeaderText="To Be Tested"
                                         ListTextField="ToBeTested"
                                         ListValueField="ToBeTestedID"  
                                         UniqueName="ToBeTestedID"
             /> 
             <telerik:GridDropDownColumn DataField="StatusID"
                                         DataSourceID="SqlDataSource2"  
                                         HeaderText="Status"
                                         ListTextField="Status"
                                         ListValueField="StatusID"  
                                         UniqueName="StatusID"
             />                   
             <telerik:GridBoundColumn    DataField="LOB"
                                         HeaderText="Line Of Business"
                                         SortExpression="LOB"
                                         UniqueName="LOB"
                                         ReadOnly="False">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn    DataField="AlliancePartner"
                                         HeaderText="Alliance Partner"
                                         SortExpression="AlliancePartner"
                                         UniqueName="AlliancePartner"
                                         ReadOnly="False">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn    DataField="DslID"
                                         HeaderText="Dsl ID"
                                         SortExpression="DslID"
                                         UniqueName="DslID"
                                         ReadOnly="False">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn    DataField="Contacts"
                                         HeaderText="Contacts"
                                         SortExpression="Contacts"
                                         UniqueName="Contacts"
                                         ReadOnly="False">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn    DataField="EmailSentDate"
                                         HeaderText="Email Sent Date"
                                         SortExpression="EmailSentDate"
                                         UniqueName="EmailSentDate"
                                         ReadOnly="False">
             </telerik:GridBoundColumn>
         </Columns>
         <EditFormSettings>
            <FormTableItemStyle Wrap="False"></FormTableItemStyle>
             <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
             <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                 Width="100%" />
             <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
             <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
             <EditColumn ButtonType="ImageButton"
                 UniqueName="EditCommandColumn1" CancelText="Cancel edit">
             </EditColumn>
             <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
         </EditFormSettings>
     </MasterTableView>
 </telerik:RadGrid>


populated from datasource1

<asp:SqlDataSource
        SelectCommand="SELECT InstallCount,PackageName,ToBeTestedID,ToBeTested,StatusID,Status,LOB,AlliancePartner,DslID,Contacts,EmailSentDate FROM AppFactory.dbo.WFCpackageinstalls"
        UpdateCommand="
            UPDATE AppFactory.dbo.WFCpackageinstalls SET
                [StatusID] = @StatusID,
                [ToBeTestedID] = @ToBeTestedID,
                [LOB] = @LOB,
                [AlliancePartner] = @AlliancePartner,
                [Contacts] = @Contacts,
                [EmailSentDate] = @EmailSentDate,
                [DslID] = @DslID
            WHERE [PackageName] = @PackageName"
        ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>"
        ProviderName="System.Data.SqlClient"
        ID="DataSource1"
        runat="server" >
        <UpdateParameters>
            <asp:Parameter Name="StatusID" Type="Int32" />
            <asp:Parameter Name="ToBeTestedID" Type="Int32" />
            <asp:Parameter Name="LOB" Type="String" />
            <asp:Parameter Name="AlliancePartner" Type="String" />
            <asp:Parameter Name="PackageName" Type="String" />
            <asp:Parameter Name="Contacts" Type="String" />
            <asp:Parameter Name="EmailSentDate" Type="String" />
            <asp:Parameter Name="DslID" Type="String" />
        </UpdateParameters>
     </asp:SqlDataSource>   
    <asp:SqlDataSource
        SelectCommand="SELECT StatusID, Status FROM AppFactory.dbo.lu_tbl_status"
        ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>"
        ProviderName="System.Data.SqlClient"
        ID="SqlDataSource2"
        runat="server"
     />
    <asp:SqlDataSource
        SelectCommand="SELECT ToBeTestedID, ToBeTested FROM AppFactory.dbo.lu_tbl_tobetested"
        ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>"
        ProviderName="System.Data.SqlClient"
        ID="SqlDataSource3"
        runat="server"
     />

inside I have two drop downs populated from lookup tables  from the queries above in datasource 2 and 3

The correct values are selected based on the actual values of the id columns in the main table.

So everything works except when I change a value for anything and save the row....
the message at the bottom says "Item Updated!" but the database is not being updated with any new values. It's aggravating.

the code behind

Imports Telerik.Web.UI
 
Partial Class AppFactory
    Inherits System.Web.UI.Page
        Private gridMessage As String = Nothing
 
        Protected Sub RadGrid1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
            If Not String.IsNullOrEmpty(gridMessage) Then
                DisplayMessage(gridMessage)
            End If
        End Sub
 
        Protected Sub RadGrid1_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs)
            If Not e.Exception Is Nothing Then
                e.ExceptionHandled = True
                SetMessage("Delete failed. Reason: " + e.Exception.Message)
            Else
                SetMessage("Item deleted!")
            End If
        End Sub
 
        Protected Sub RadGrid1_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs)
            If Not e.Exception Is Nothing Then
                e.KeepInEditMode = True
                e.ExceptionHandled = True
                SetMessage("Update failed. Reason: " + e.Exception.Message)
            Else
            SetMessage("Item updated! " + source.ToString)
            End If
        End Sub
 
        Protected Sub RadGrid1_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs)
            If Not e.Exception Is Nothing Then
                e.ExceptionHandled = True
                e.KeepInInsertMode = True
                SetMessage("Insert failed. Reason: " + e.Exception.Message)
            Else
                SetMessage("New product is inserted!")
            End If
        End Sub
 
        Private Sub DisplayMessage(ByVal text As String)
            RadGrid1.Controls.Add(New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
        End Sub
 
        Private Sub SetMessage(ByVal message As String)
            gridMessage = message
        End Sub
End Class



Andrey
Telerik team
 answered on 04 Jul 2012
1 answer
207 views
Hi,

I downloaded  2012.2 607 and Hotfix 2012.2 626 and it seems to have a problem when you use RadNumericTextbox with SpinButtons. For some reason with these builds after clicking up on the SpinButton the value gets appended instead of being added.  When you try to press the down SpinButton, it doesn't work.  My Code snippet is below as well as an image of the problem.


<asp:Panel ID="myPanel" runat="server">
    <div align="center">
        <telerik:RadNumericTextBox ID="txtV" runat="server" Width="155px" Height="32px" ShowSpinButtons="True" EnableSingleInputRendering="false" Type="Number" InvalidStyleDuration="100" Font-Size="20px" MinValue="100" Value="100">
            <NumberFormat AllowRounding="False" KeepNotRoundedValue="False" />
            <IncrementSettings Step="100" />
        </telerik:RadNumericTextBox>
    </div>
</asp:Panel>






Milena
Telerik team
 answered on 04 Jul 2012
1 answer
116 views
Hi

How to always have one button toggled in a toggle buttons groupof RadToolBar??

Kate
Telerik team
 answered on 04 Jul 2012
1 answer
124 views
I am trying to use a RadRotator control inside an aspnet UpdatePanel.  The RadRotator displays a set of images whenever the user clicks a button.  It works as expected in IE 9, but when I view the page in Firefox (version 13.0.1), the RadRotator width is set to 0 on the first postback.  It will display on subsequent postbacks -- just not the initial one.    

The develomplent is in VS 2010, and the version of the Telerik library is 2011.3.1115.40.

Here is a simplified example of the ASPX file and CodeBehind that is causing the issue:

ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ImageRotatorTest.WebForm1" %>
<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:UpdatePanel runat="server" ID="up1">
      <ContentTemplate>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
             <telerik:RadRotator ID="itemsRotator" runat="server"  Width="600px" Height="118px"
                        ItemHeight="108" ItemWidth="81" WrapFrames="false" RotatorType="Buttons" ScrollDuration="1" FrameDuration="1"
                        Visible="False" >
                        <ItemTemplate>
                            <asp:Image runat="server" Height="108" Width="81" BorderStyle="Solid" BorderColor="DarkGray" BorderWidth="1" ID="JobImage" ImageUrl='<%# Eval("ImagePath") %>' />
                        </ItemTemplate>
             </telerik:RadRotator>
    </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>


CodeBehind:
namespace ImageRotatorTest
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        class RotatorImage
        {
            public RotatorImage(string imagePath)
            {
                ImagePath = imagePath;
            }
            public string ImagePath { get; set; }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DisplayRotator();
        }

        private void DisplayRotator()
        {
            List<RotatorImage> imageList = new List<RotatorImage>();
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            imageList.Add(new RotatorImage("Images/Squirrel.jpg"));
            itemsRotator.Visible = true;
            itemsRotator.DataSource = imageList;
            itemsRotator.DataBind();
        }
    }
}

The problem seems to be stemming from the fact that the RadRotator visibility is initially set to false, because when it is initially set to true the problem disappears.  Unfortunately, I need to initially hide the RadRotator until the user clicks a button.   Also, eliminating the UpdatePanel is not an option because we have other code that depends on it.  Please help.


Thanks,
Scott Howard
Slav
Telerik team
 answered on 04 Jul 2012
1 answer
137 views
Hi,

I need to implement drag and drop on a treeview in such a way that it should allow drag and drop only between same level of nodes.

Thanks,
Stephen Lewis
Princy
Top achievements
Rank 2
 answered on 04 Jul 2012
5 answers
196 views
Please help me for changing my Slider Items With?

Kindly Regards

   .RadSlider5_Custom .rslItem, .RadSlider5_Custom .rslLargeTick span
             {
                 width: 25px;
                 }

did not work (
omer
Top achievements
Rank 1
 answered on 04 Jul 2012
4 answers
130 views
Hi,

I'm trying to create dynamic dock controls with customs command in their title bar. I've read everywhere that those dock must be re-created in the OnInit event which I think I'm doing.
Here's my code:
1 - I'm adding a dock to the DockLayout by clicking on a radbutton (RadButtonCreate_Click) and load a control within that dock via Loadcontrol.
Everything looks fine at that stage.

2 - When I click on my custom command "SaveToDB", it does work the way I like and insert all the data to the DB and update the title of my dock via a Dock Title Template implementing ITemplate.

3 - When I click again on that command "SaveToDB", nothing happens. The OnClientCommand is fired but the server side handler is no longer called.

What am I doing wrong here ? 

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["CurrentDockStatesDynamicDocks"];
        if (Object.Equals(_currentDockStates, null))
        {
            _currentDockStates = new List<DockState>();
            Session["CurrentDockStatesDynamicDocks"] = _currentDockStates;
        }
        return _currentDockStates;
    }
    set
    {
        Session["CurrentDockStatesDynamicDocks"] = value;
    }
}
 
private RadDock CreateRadDockFromState(DockState state)
{
    RadDock dock = new RadDock();
    try
    {
        dock.ID = string.Format("RadDock{0}", state.UniqueName);
 
        dock.ApplyState(state);
        dock.EnableRoundedCorners = true;
 
        dock.Command += new DockCommandEventHandler(dock_Command);
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        var dockSaveCmd = new DockCommand();
        dockSaveCmd.Name = "SaveToDB";
        dockSaveCmd.Text = "Save";
        dockSaveCmd.CssClass = "sdSaveCmd";
        dockSaveCmd.OnClientCommand = "SaveStopToDB";
        dock.Commands.Add(dockSaveCmd);
    }
    catch (Exception ex)
    {
        return null;
        throw new Exception(ex.Message, ex.InnerException);
    }
    return dock;
}
 
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++)
    {
        RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
        RadDockLayout1.Controls.Add(dock);
        CreateSaveStateTrigger(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);
}
 
void dock_Command(object sender, DockCommandEventArgs e)
{
    if (e.Command.Name == "Close")
    {
        ScriptManager.RegisterStartupScript(
        UpdatePanel1,
        this.GetType(),
        "RemoveDock",
        string.Format(@"function _removeDock() {{ 
                        Sys.Application.remove_load(_removeDock); 
                        $find('{0}').undock(); 
                        $get('{1}').appendChild($get('{0}')); 
                        $find('{0}').doPostBack('DockPositionChanged'); 
                        }}; 
                        Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID),
                      true);
 
    }
    else if (e.Command.Name == "SaveToDB")
    {
        var dock = ((RadDock)sender);
        var stop = new Stop()
        {
            Id = int.Parse(dock.Tag),
            Name = ((RadTextBox)stopCtrl.FindControl("rtbName")).Text,
            Description = ((RadTextBox)stopCtrl.FindControl("TB_description")).Text,
        };
 
        if (stop.Id < 0)
        {
            stop.Id = stop.Insert();
            dock.Tag = stop.Id.ToString();
        }
        else
            stop.Update();
    }
}
 
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)
{
    //Save the dock state in the page Session. This will enable us
    // to recreate the dock in the next Page_Init.
    CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();
}
 
protected void RadButtonCreate_Click(object sender, EventArgs e)
{
    var dock = new RadDock();
    dock.DockMode = DockMode.Docked;
    dock.EnableRoundedCorners = true;
    dock.UniqueName = Guid.NewGuid().ToString();
    dock.ID = string.Format("RadDock{0}", dock.UniqueName);
    dock.Tag = "-1";
    StopFormTplEmpty widget = (StopFormTplEmpty)GlobalUtils.LoadControl(this, "~/Templates/StopFormTplEmpty.ascx");
    widget.EnableViewState = true;
    dock.ContentContainer.Controls.Add(widget);
 
    dock.TitlebarTemplate = new DockTitleTemplate(dock, StopType.Unknown, "New");
    dock.Width = Unit.Percentage(100);
    dock.Height = Unit.Pixel(420);
    dock.Commands.Add(new DockCloseCommand());
    dock.Commands.Add(new DockExpandCollapseCommand());
    var dockSaveCmd = new DockCommand();
    dockSaveCmd.Name = "SaveToDB";
    dockSaveCmd.Text = "Save";
    dockSaveCmd.CssClass = "sdSaveCmd";
    dockSaveCmd.OnClientCommand = "SaveStopToDB";
    dock.Commands.Add(dockSaveCmd);
    dock.CommandsAutoPostBack = true;
    dock.Command += new DockCommandEventHandler(dock_Command);
    UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);
 
    ScriptManager.RegisterStartupScript(
    dock,
    this.GetType(),
    "AddDock",
    string.Format(@"function _addDock() {{ 
                        Sys.Application.remove_load(_addDock); 
                        $find('{1}').dock($find('{0}'),{2});  
                        $find('{0}').doPostBack('DockPositionChanged'); 
                        }}; 
                        Sys.Application.add_load(_addDock);", dock.ClientID, RadDockZoneStops.ID, 0),
                                                            true);
    CreateSaveStateTrigger(dock);
}
Slav
Telerik team
 answered on 04 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?