Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
68 views
Hi,

i have used the radgrid to display the documents.
i'll get the Script error when i click the "add new button"
Help me to resolve this problem.

My Code is:
<form id="form1" runat="server">
   <telerik:RadScriptManager runat="server" ID="rsmQuoteDocument">
   </telerik:RadScriptManager>
   <telerik:RadWindowManager ID="rwmQuoteDoc" runat="server">
   </telerik:RadWindowManager>
   <input id="DcoId" type="hidden" runat="server" />
   <asp:Button ID="btnDOC" runat="server" OnClick="btnDOC_Click" Style="display: none" />
   <telerik:RadAjaxManager runat="server" ID="ramQuotesDoc">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID ="rgQouteDocuments">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="rapDocument" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
   <telerik:RadAjaxPanel ID="rapDocument" runat="server">
       <telerik:RadGrid runat="server" ID="rgQouteDocuments" Skin="Office2007"
           Width="99.5%" ondeletecommand="rgQouteDocuments_OnDeleteCommand"
           oninsertcommand="rgQouteDocuments_OnInsertCommand"
           onitemdatabound="rgQouteDocuments_OnItemDataBound"
           onneeddatasource="rgQouteDocuments_NeedDataSource"
           onupdatecommand="rgQouteDocuments_OnUpdateCommand" AllowAutomaticInserts="false" AllowAutomaticUpdates="true" AutoGenerateColumns="false">
           <ClientSettings>
               <Selecting EnableDragToSelectRows="false" AllowRowSelect="true" />
           </ClientSettings>
           <ItemStyle CssClass="RadGridItem" />
           <AlternatingItemStyle CssClass="RadGridItem" />
           <PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Pages" ShowPagerText="false" />
           <MasterTableView DataKeyNames="QuoteDocumentID,QuoteId" CommandItemDisplay="Top"
               EditMode="EditForms">
               <NoRecordsTemplate>
                   <center>
                       <asp:Label ID="lblnoRecords" runat="server" CssClass="label" Text="No records found" />
                   </center>
               </NoRecordsTemplate>
               <Columns>
                   <telerik:GridBoundColumn UniqueName="QuoteDocumentID" HeaderText="DocumentID" DataField="QuoteDocumentID"
                       Visible="false" ReadOnly="true">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn UniqueName="QuoteId" HeaderText="Quote ID" DataField="QuoteId"
                       Visible="false" ReadOnly="true">
                   </telerik:GridBoundColumn>
                   <telerik:GridButtonColumn UniqueName="ViewAppraisal" ButtonType="ImageButton" ImageUrl="~/Images/view-inventory.png"
                       Text="DownLoad" HeaderStyle-Width="110px" Visible="false">
                       <ItemStyle HorizontalAlign="Center" />
                   </telerik:GridButtonColumn>
                   <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Images/edit.png"
                       HeaderStyle-Width="30px">
                   </telerik:GridEditCommandColumn>
                   <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="../Images/delete.png"
                       CommandName="delete" ItemStyle-HorizontalAlign="Center" ConfirmDialogType="RadWindow"
                       ConfirmDialogHeight="25px" ConfirmDialogWidth="410px" ConfirmTitle="Delete Document"
                       ConfirmText="Are you sure you want to delete this Inventory Documents?" HeaderStyle-Width="30px"
                       UniqueName="30px">
                   </telerik:GridButtonColumn>
                   <telerik:GridTemplateColumn HeaderText="Document Comment" EditFormHeaderTextFormat="Comment"
                       UniqueName="Comment" DataField="DocumentComment">
                       <ItemTemplate>
                           <asp:Label ID="lblDocumentComment" runat="server" Text='<%# Eval("DocumentComment") as string %>' />
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadTextBox ID="txbDescription" Width="250px" runat="server" TextMode="MultiLine"
                               Text='<%# Eval("DocumentComment") %>' Height="150px" />
                       </EditItemTemplate>
                       <ItemStyle VerticalAlign="Top" />
                   </telerik:GridTemplateColumn>
                   <telerik:GridDateTimeColumn DataField="DateUploaded" DataFormatString="{0:dd/MM/yyyy}"
                       HeaderText="Upload Date" EditFormHeaderTextFormat="Upload Date" ReadOnly="True">
                   </telerik:GridDateTimeColumn>
                   <telerik:GridBoundColumn UniqueName="UserId" HeaderText="Uploaded By" DataField="UserId"
                       ReadOnly="True" Visible="false" />
                   <telerik:GridBoundColumn UniqueName="UploadedBy" HeaderText="Uploaded By" DataField="UploadedBy"
                       EditFormHeaderTextFormat="UploadedBy" ReadOnly="True" ItemStyle-CssClass="mousepointer" />
                   <telerik:GridTemplateColumn HeaderText="Document" EditFormHeaderTextFormat="Upload Files"
                       UniqueName="Document" DataField="DocumentComment" Visible="false">
                       <ItemTemplate>
                           <asp:LinkButton ID="lbtnDocument" runat="server" Text='<%#Eval("DocumentPath") %>'></asp:LinkButton>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <br />
                           <telerik:RadAsyncUpload HttpHandlerUrl="~/CustomHandler.ashx" ID="ruDocument" runat="server"
                               AllowedFileExtensions=".doc,.docx,.xlsx,.pdf,.dox,.rtf,.txt">
                           </telerik:RadAsyncUpload>
                           (Use format .doc,.docx,.xlsx,.pdf,.dox,.rtf,.txt)
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridButtonColumn HeaderText="Documents" ButtonType="LinkButton" UniqueName="Documents"
                       DataTextField="FileName" />
                   <telerik:GridBoundColumn UniqueName="DocumentName" DataField="DocumentPath" Visible="false"
                       ReadOnly="true" />
               </Columns>
               <CommandItemTemplate>
                   <table border="0" style="width: 100%;">
                       <tbody>
                           <tr>
                               <td align="left">
                                   <asp:LinkButton ID="AddNewRecordButton" runat="server" CommandName="InitInsert">
                                               <img style="border:0px" alt="Add New" src="../Images/add-icon.png" /> Add new document
                                   </asp:LinkButton>
                               </td>
                           </tr>
                       </tbody>
                   </table>
               </CommandItemTemplate>
               <EditFormSettings>
                   <EditColumn ButtonType="ImageButton" />
               </EditFormSettings>
           </MasterTableView>
       </telerik:RadGrid>
   </telerik:RadAjaxPanel>




Pavlina
Telerik team
 answered on 22 Apr 2011
4 answers
103 views
this is my grid definition from aspx page; the columns are generated in the code-behind in page_init
<telerik:RadGrid ID="competenceGrid" runat="server" Width="99%">
       <ClientSettings>
               <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="4">
               </Scrolling>
               <ClientEvents OnGridCreated="GridCreated" />
       </ClientSettings>
       <MasterTableView TableLayout="Fixed" Width="100%" Height="100%">
           <RowIndicatorColumn>
               <HeaderStyle Width="20px"></HeaderStyle>
           </RowIndicatorColumn>
           <ExpandCollapseColumn>
               <HeaderStyle Width="20px"></HeaderStyle>
           </ExpandCollapseColumn>
       </MasterTableView>
       <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
       </HeaderContextMenu>
       <ItemStyle HorizontalAlign="Center"/>
       <ActiveItemStyle HorizontalAlign="Center" />
       <AlternatingItemStyle HorizontalAlign="Center" />
       <HeaderStyle Width="160px" Height="75px" />
   </telerik:RadGrid>
Everthing work well in IE8-9, Firefox, but not IE7 where when i horizontal scroll to the end of the right side the first 2 columns from the left which are not  frozen and normally should be displayed are in fact overlaped.
I tried with different combination's for the width value (%) for  the mastertableview  and the radgrid and also in conjunction with tablelayout="fixed|auto". Also the container of the grid have a fixed width in pixels.
Please see the picture attached
Any ideea ?
Pavlina
Telerik team
 answered on 22 Apr 2011
3 answers
79 views
HI there,

I am experiencing some strange behaviour when using a custom dialogue to paste an html fragement, which is a "locked" area within the editor (ie, contenteditable=false). 

The paste works the first time around, with the expected html being injected into the editor, but when i revisit the locked area, and edit editing it via the custom dialogue, on re-pasting, I get extra attributes within the pasted fragment. 

Eg, first paste looks like:
<span class="Hotword" id="1" contenteditable="false" xml="Hotword">test</span>

Second paste (from same dialogue, with same javascript etc...) looks like:
<span class="Hotword" id="1" title="test" contenteditable="false" cssclass="Hotword" xml="Hotword" doPaste="true">test </span>


To recreate, I have 2 pages (pasted below).  On the page containing the editor, create a simple 1 word piece of text, highlight, and clikc the "hotword" button, bringing up the dialogue.  Enter some values and click OK.  All is fine at this point (ie, expected markup from 1st fragment above).  Then, select the locked area again, and right click, go to "custom properties", which re-opens the dialogue,  On clicking OK again, I end up with the 2nd fragment above being pasted. 

Im really stuck with this one, so if anyone can offer any help, that would be great!


My editor page markup looks like this:

 

 

 

<style type="text/css">
    .reToolbar.Default .InsertHotword
    {
    }
    </style>
      
     <script type="text/javascript">
          
  
        Telerik.Web.UI.Editor.CommandList["CustomProperties"] = function(commandName, editor, args)
        {
        // get the selected Html
          var currentSelectedHtml = editor.getSelectionHtml();
      
          var elem = editor.getSelectedElement();
          editor.selectElement(elem);
          argument = elem;  
           
   
          var myCallbackFunction = function(sender, args)
          {
            if(args.doPaste == true)
                editor.pasteHtml(String.format("<span id={0} contenteditable='false' class='{1}' xml='{2}'>{3}</span> ", args.id, args.cssclass, args.xml, args.title))
          }
       
          editor.showExternalDialog(
               "Hotword.aspx",
               argument,
               450,
               350,
               myCallbackFunction,
               null,
               "Hotword",
               true,
               Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
               false,
               false);
    };
  
  
     Telerik.Web.UI.Editor.CommandList["InsertHotword"] = function(commandName, editor, args)
        {
          // get the selected Html
          var currentSelectedHtml = editor.getSelectionHtml();
  
          var elem = editor.getSelectedElement();
  
          if(elem.tagName == 'BODY')
          {
             var content = editor.getSelectionHtml();
             var link = editor.get_document().createElement("FONT");
             link.innerHTML = currentSelectedHtml;         
             argument = link;
          }
            
          var myCallbackFunction = function(sender, args)
          {
            if(args.doPaste == true)
                editor.pasteHtml(String.format("<span id={0} contenteditable='false' class='{1}' xml='{2}'>{3}</span> ", args.id, args.cssclass, args.xml, args.title))
           
          }
       
          editor.showExternalDialog(
               'Hotword.aspx',
               argument,
               450,
               350,
               myCallbackFunction,
               null,
               'Hotword',
               true,
               Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
               false,
               false);
    };
  
          
    </script>
      
     
    <asp:ScriptManager id="ScriptManager" runat="server"/>
  
        <telerik:RadEditor ID="rdedContent" runat="server" Width="340px" Height="450px" SkinID="DefaultSetOfTools" ToolsFile="AuthoringTools.xml">
               <Tools>
                 <telerik:EditorToolGroup>
                        <telerik:EditorTool Name="InsertHotword" Text="Hotword" ShowText="true" ShowIcon="false" />
                 </telerik:EditorToolGroup>
              </Tools>
            <ContextMenus>
               <telerik:EditorContextMenu TagName="A" Enabled="false"></telerik:EditorContextMenu>
                <telerik:EditorContextMenu>
                  <telerik:EditorTool name="Cut"/>
                  <telerik:EditorTool name="Copy"/>
                  <telerik:EditorTool name="Paste"/>
                  <telerik:EditorTool name="CustomProperties"/>
                </telerik:EditorContextMenu>             
            </ContextMenus>
        </telerik:RadEditor>


And my custom dialogue markup looks like this:
<asp:ScriptManager id="ScriptManager" runat="server"/>
   <div>
   Hotword Properties:
   <br />
   title: <input type="text" id="hotwordTitle">
   <br /><br />
   Content:        
   <telerik:RadEditor ID="rdedContent" runat="server" Width="200px" Height="150px" SkinID="DefaultSetOfTools" ToolsFile="AuthoringTools.xml"></telerik:RadEditor>
<br />
       <input type="button" onclick="javascript:insertContent();" value="OK"/>
   </div>
     
     <script type="text/javascript">
  if (window.attachEvent)
  {
      window.attachEvent("onload", initDialog);
  }
  else if (window.addEventListener)
  {
      window.addEventListener("load", initDialog, false);
  }
  var hotwordTitle = document.getElementById("hotwordTitle");
  var hotword = null;
  function getRadWindow()
  {
         if (window.radWindow)
      {
          return window.radWindow;
      }
      if (window.frameElement && window.frameElement.radWindow)
      {
          return window.frameElement.radWindow;
      }
      return null;
  }
  function initDialog()
  {
     var clientParameters = getRadWindow().ClientParameters; //return the arguments supplied from the parent page
            
     hotwordTitle.value = clientParameters.innerHTML;
      
     hotword = clientParameters;
  }
  function insertContent() 
  {
     //create an object and set some custom properties to it     
     hotword.id = '1';
     hotword.cssclass = 'Hotword';
     hotword.xml = 'Hotword';
     hotword.title = hotwordTitle.value;
     hotword.doPaste = true;
            
     getRadWindow().close(hotword);
  }
  </script>

Rumen
Telerik team
 answered on 22 Apr 2011
1 answer
84 views
Hello

I need to extend a project that has been developed with radcontrols for asp.net ajax Q3 2009. The customer has explicitly asked for a page with data displayed as a tree structure with the following requirments : I'll have to query the db, group records by year, quarter,department and "complaint code". Therefore i have to dinamically build the tree  adding a year root node for each distinct year ,  1-4 quarter subnode below each year, 1-n department below each quarter and 1-m "complaint code" below each department. Moreover i'd like to display data on demand, since i fear, in the long term, the building and load of the tree might become very cumbersome. Another feature i've to add is displaying richest infos about the complaint , i mean every complaint code has some additional details that the user want to see at first glance; i was thinking to use node templates , embedding a grid or something else into nodes .   

The first question is : am i putting myself into troubles or the above is a reasonable solution to my requirements ?

Next , i've searched around a bit but i'm not finding much and i've some problems in figuring out how to put togheter all the features described above, can someone direct me to some tutorial, documentation or give any hint about which is the best way to accomplish it please?

thank you in advance for any help
Stefano
Nikolay Tsenkov
Telerik team
 answered on 22 Apr 2011
1 answer
120 views
Hi Telerik Team,

       We are using RadTreeView(Telerik.Web.UI).The properties like CssClassOver,ContextMenuName,SourceDragNode,DestDragNode of RadTreeNode are missing in it.How can we solve this problem?

Waiting for the reply.
Dayana
Kate
Telerik team
 answered on 22 Apr 2011
1 answer
67 views
Hello,


Problem in RadScheduler(Width) auto adjustment in any screen(Big And Small) and in IE/FireBox/Grome/Shafari.


We used 


script type="text/javascript">
    function resizeScheduler()   
                  {
                      var scheduler = $find('<%=RadScheduler1.ClientID %>');
                      scheduler.get_element().style.width = "100%";
                      scheduler.repaint();
                  }
</script> 
And also set width=100% in RadScheduler control


In C# code
RadScheduler1.Width = Unit.Percentage(100);
but it is not work.


please help me as soon as possible.




Thanks


Best Regards
Mutum Jiten Singh
Akhil Systems
Veronica
Telerik team
 answered on 22 Apr 2011
1 answer
34 views
Hello,
We Used the following javascript:

<script type="text/javascript">
    function resizeScheduler()   
                  {
                      var scheduler = $find('<%=RadScheduler1.ClientID %>');
                      scheduler.get_element().style.width = "100%";
                      scheduler.repaint();
                  }
</script>
And call in the scheduler control of onload event.

And also c# code,
RadScheduler1.Width = Unit.Pixel(800);
or
RadScheduler1.Width = Unit.Percentage(100);

But it is not work.

Problem in RadScheduler(Width) auto adjustmen in any screen(Big And Small) and in IE/FireBox/Grome/Shafari.

Please help me as soon as possible.

Thanks

Mutum JIten Singh
Akhil Systems
Veronica
Telerik team
 answered on 22 Apr 2011
3 answers
115 views
Hello, 

I am trying to use the example http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx on a masterpage. I have done some research and I think the error has to do with using the dock.ID instead of ClientID but not totally sure and am unsure of how to correct properly. Can anyone please give me a suggestion on how to correct he problem.

Thanks

(inside pageview)...
                    <asp:UpdatePanel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="false" UpdateMode="Conditional">
                        <ContentTemplate>
                            <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnSaveDockLayout="RadDockLayout1_SaveDockLayout"
                                OnLoadDockLayout="RadDockLayout1_LoadDockLayout">
                                <telerik:RadDockZone runat="server" ID="RadDockZone1" Width="550" MinHeight="50"
                                    Style="float: left" UniqueName="Folder Zone 1">
                                </telerik:RadDockZone>
                                <telerik:RadDockZone runat="server" ID="RadDockZone2" Width="320" MinHeight="50"
                                    Style="float: left; background: #f5f4e8;" UniqueName="Folder Zone 2">
                                </telerik:RadDockZone>
                                <telerik:RadDockZone runat="server" ID="RadDockZone3" Width="880" MinHeight="50"
                                    Style="background: #d5f0fa; float: left;" UniqueName="Folder Zone 3">
                                </telerik:RadDockZone>
                                <div style="display: none">
                                    Hidden UpdatePanel, which is used to receive the new dock controls. We will move
                                    them with script to the desired initial dock zone.
                                    <asp:UpdatePanel runat="server" ID="UpdatePanel3">
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="ButtonAddDock" EventName="Click" />
                                        </Triggers>
                                    </asp:UpdatePanel>
                                </div>
                            </telerik:RadDockLayout>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ButtonAddDock" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
-----------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Script.Serialization;
using System.Text;
using System.Collections;
 
public partial class MBA_Folder : System.Web.UI.Page
{
    private const string cookiename = "__dockState";
 
    private List<DockState> GetDocks(string cookieName)
    {
        List<DockState> currentDocks = new List<DockState>();
 
        string dockState;
        JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        HttpCookie positionsCookie = Request.Cookies[cookiename];
        if (!Object.Equals(positionsCookie, null))
        {
            dockState = positionsCookie.Value;
            string[] currentDockStates = dockState.Split(new Char[] { '|' });
            foreach (string stringState in currentDockStates)
            {
                if (stringState != string.Empty)
                {
                    DockState state = new DockState();
                    state = serializer.Deserialize<DockState>(stringState);
                    currentDocks.Add(state);
                }
            }
        }
 
        return currentDocks;
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownZone.DataBind();
        }
    }
 
    public ArrayList GetZones()
    {
        ArrayList zones = new ArrayList();
        zones.Add(RadDockZone1);
        zones.Add(RadDockZone2);
        zones.Add(RadDockZone3);
        return zones;
    }
 
    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()
    {
        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 = DroptDownWidget.SelectedItem.Text;
        dock.Text = string.Format("Added at {0}", DateTime.Now);
        dock.Width = Unit.Pixel(300);
 
 
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        return dock;
    }
 
    //    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);
    //        }
    //    }
 
    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);
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
 
        List<DockState> CurrentDockStates = GetDocks(cookiename);
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
            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);
            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.
        List<DockState> CurrentDockStates = GetDocks(cookiename);
        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)
    {
 
        string dockState;
 
        JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        List<DockState> stateList = ((RadDockLayout)sender).GetRegisteredDocksState(true);
        StringBuilder serializedList = new StringBuilder();
        int i = 0;
        while (i < stateList.Count)
        {
            serializedList.Append(serializer.Serialize(stateList[i]));
            serializedList.Append("|");
            i++;
 
        }
 
        dockState = serializedList.ToString();
 
        HttpCookie positionsCookie = new HttpCookie(cookiename, dockState);
 
        //Ensure that the cookie will not expire soon
        positionsCookie.Expires = DateTime.Now.AddYears(1);
        Response.Cookies.Add(positionsCookie);
    }
 
    protected void ButtonAddDock_Click(object sender, EventArgs e)
    {
        RadDock dock = CreateRadDock();
        //find the target zone and add the new dock there
        RadDockZone dz = (RadDockZone)FindControl(DropDownZone.SelectedItem.Text);
        dz.Controls.Add(dock);
        CreateSaveStateTrigger(dock);
 
        //Load the selected widget in the RadDock control
        dock.Tag = DroptDownWidget.SelectedValue;
        LoadWidget(dock);
 
        //Right now the RadDock control is not docked. When we try to save its state
        // later, the DockZoneID will be empty. To workaround this problem we will
        // set the AutoPostBack property of the RadDock control to true and will
        // attach an AsyncPostBackTrigger for the DockPositionChanged client-side
        // event. This will initiate second AJAX request in order to save the state
        // AFTER the dock was docked in RadDockZone1.
        CreateSaveStateTrigger(dock);
    }
 
    private void LoadWidget(RadDock dock)
    {
        if (string.IsNullOrEmpty(dock.Tag))
        {
            return;
        }
        Control widget = LoadControl(dock.Tag);
        dock.ContentContainer.Controls.Add(widget);
    }
 
    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;
    }
}
Pero
Telerik team
 answered on 22 Apr 2011
1 answer
110 views
Hello,
    I want to use captcha in my login page. I have username textbox and password textbox and loginbutton.
If the username or password was fail three times i want to show captcha image and then after tens time i want to disable user.
Any Suggestion?
Pero
Telerik team
 answered on 22 Apr 2011
1 answer
157 views
I am using RadCaptcha in a user control in an application form.  It contains many asp.net controls (ie textboxes, dropdownlists, and etc) that expanded the form from top to bottom result in a vertical scroll bar.  The RadCaptcha is placed at the bottom before the submit button.

Functionality wise, the RadCaptcha is working as expect but everytime I click the link to play the audio, the form would automatically scrolls to the top instead of staying at the bottom.  In contract, the Generate New Image would stay where it is after a new image is generated.  Is this the normal behavor of the control?  How do I prevent it from focus to the top of the form when playing the audio?

Regards,

Donny


===
This is how I added the RadCaptcha to the usercontrol:

 

protected void Page_Init(object sender, System.EventArgs e)
  
  
captcha = new Telerik.Web.UI.RadCaptcha();
  
captcha.ID = "captcha";
  
captcha.ErrorMessage = "The security code you entered did not match. Please try again.";
  
captcha.EnableRefreshImage = true;
  
captcha.CaptchaAudioLinkButtonText = "Play Audio Code";
  
captcha.CaptchaImage.EnableCaptchaAudio = true;
  
captcha.CaptchaImage.AudioFilesPath = Server.MapPath("/forms/RadCaptcha");
  
captcha.CaptchaImage.UseAudioFiles = true;
  
captcha.CaptchaTextBoxLabel = String.Empty;
  
captcha.Visible = true;
  
divCaptcha.Controls.Add(captcha);
  
}

 

 

 

 

Pero
Telerik team
 answered on 22 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?