Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
132 views
How can I make anchors on a page visible in the Design Mode?

They seem to be always hidden.

BR,
Marc
Dobromir
Telerik team
 answered on 03 Jan 2011
5 answers
164 views
Hi,

 I am using the RadCalendar in my webpage. While clicking on the particular date i did open the radwindow in that window i am having 3 textboxes , after entering the values in that, need to display on the particular date of that Calendar page...Now i am able to display one value ,,but how to do another two values. Tell me how to do?
Brown
Top achievements
Rank 1
 answered on 03 Jan 2011
6 answers
230 views
Hello,

I'm currently prototyping a menu where I want a child menu item to make an Ajax call, alter the Image on the parent menu, and then close the parent menu.  Here is my menu:

<Telerik:RadMenu ID="Menu_gob" runat="server" Skin="Default" OnClientItemClicked="MenuItemClicked"
    <Items> 
        <Telerik:RadMenuItem Value="AllTopics" Text="Top/All Topics" /> 
        <Telerik:RadMenuItem Value="CurrentTopic" Text="Page Lifecycle" ImageUrl="~/CABS_Images/Icon_NotSubscribed.png"
            <Items> 
                <Telerik:RadMenuItem Value="CurrentTopicNewThread" Text="Start a New Thread" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> 
                <Telerik:RadMenuItem Value="CurrentTopicSubscription" Text="Turn ON Notifications" ImageUrl="~/CABS_Images/Icon_Subscribed.png" /> 
            </Items> 
        </Telerik:RadMenuItem> 
        <Telerik:RadMenuItem Value="CurrentThread" Text="NEW THREAD, 2, 3, 4..."  ImageUrl="~/CABS_Images/Icon_Subscribed.png"
            <Items> 
                <Telerik:RadMenuItem Value="CurrentThreadNewPost" Text="Post a Reply" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> 
                <Telerik:RadMenuItem Value="CurrentThreadSubscription" Text="Turn OFF Notifications" ImageUrl="~/CABS_Images/Icon_NotSubscribed.png" /> 
            </Items> 
        </Telerik:RadMenuItem> 
        <Telerik:RadMenuItem Value="NewPost" Text="Post a Reply" ImageUrl="~/CABS_Images/Icon_NewDocument.png" /> 
        <Telerik:RadMenuItem Value="CannotPost" Text="This Thread is Read-Only" ImageUrl="~/CABS_Images/Icon_CannotPost.png" /> 
    </Items> 
</Telerik:RadMenu> 
 

I use the OnClientItemClicked event currently just to check the item being clicked, toggle the images, and close the menu.  There's no Ajax involvement yet.

<script language="javascript" type="text/javascript"
    var subbed_gbl = false
    function MenuItemClicked(sender, args) { 
        var clickedMenuItem = args.get_item(); 
        if (clickedMenuItem.get_value() == 'CurrentTopicSubscription') { 
            var CurrentTopicMenuItem = $find("<%= Menu_gob.ClientID %>").findItemByValue('CurrentTopic'); 
            subbed_gbl = !subbed_gbl; 
            if (subbed_gbl) { 
                clickedMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_NotSubscribed.png'); 
                clickedMenuItem.set_text('Turn Off Notifications'); 
                CurrentTopicMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_Subscribed.png'); 
            } else { 
                clickedMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_Subscribed.png'); 
                clickedMenuItem.set_text('Turn On Notifications'); 
                CurrentTopicMenuItem.set_imageUrl('<%= Application("ApplicationPath") %>/CABS_Images/Icon_NotSubscribed.png'); 
            } 
            //  CurrentTopicMenuItem.blur(); 
            //  CurrentTopicMenuItem.set_selected(false); 
            //  CurrentTopicMenuItem.close(); 
            sender.close(); 
        } 
    } 
</script> 
 

This works, except that immediately after the menu closes, it opens again.  As you can see, I've tried a few different things.  I've closed it, blurred it, un-selected it, and in various different orders.  I've done this by referencing both "sender" and "CurrentTopicMenuItem", which I programmatically set to the parent menu item.  None of them do the trick.  The menu always closes and then immediately opens again.

(Note that <%= Application("ApplicationPath") %> is just a way to reference the root of the web since it can vary from development to production.)

Can you help?


Yana
Telerik team
 answered on 03 Jan 2011
6 answers
189 views
I'm using a Progress Area Control to monitor the progess of some code (actually just calling System.Threading.Thread.Sleep(4000)) for right now to simulate code doing stuff. Anyway, it runs fine until it finishes, at which point both the progress bar and the OperationText seem to "reset" back to the first thing I set it to.

For example.

I initially set the PrimaryPercent to 0 and the CurrentOperationText to:  "Initialization started...". the last thing I do is set the PrimaryPercent to 100 and the CurrentOperationText to:  "Initialization Complete...".  It shows this on screen but then seems to reset the PrimaryPercent to 0 and the CurrentOperationText back to:  "Initialization started..." before the page response is finished.

Any idea why? I'm setting the progressContext.OperationComplete = True before the final update. Here's my full code:

<asp:button runat="server" ID="btnInitialize" Text="Initialize" CssClass="button" />    
 
<telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
    <telerik:RadProgressArea ID="rpaInit" Width="100%" ProgressIndicators="TotalProgressBar, CurrentFileName" runat="server" Skin="GCSD" EnableEmbeddedSkins="false">
      <ProgressTemplate>
        <ul class="ruProgress" runat="server">
                <li class="ruProgressHeader" runat="server"><span id="ProgressAreaHeader" runat="server"></span></li>
                <li class="ruFilePortion" runat="server"><div id="PrimaryProgressBarOuterDiv" class="ruBar" runat="server"><div id="PrimaryProgressBarInnerDiv" runat="server"></div></div></li>
                <li class="ruCurrentFile width100Percent" runat="server"><span class="lblCurrentOperationTitle">Status:</span><asp:label runat="server" id="CurrentOperation" class="lblCurrentOperation" /></li>
            </ul>
    </ProgressTemplate>
     
<Localization Uploaded="Uploaded"></Localization>
     
    </telerik:RadProgressArea>


Private Sub UpdateProgressMessage(ByVal progressContext As Telerik.Web.UI.RadProgressContext, ByVal strMessage As String, ByVal intPercentComplete As Integer)
        Dim strScript As String
        Dim writer As New StringWriter
  
        progressContext.PrimaryPercent = intPercentComplete
        progressContext.CurrentOperationText = String.Format("{0}", strMessage)
  
        progressContext.Serialize(writer)
  
        strScript = String.Format("{1};Sys.Application.add_load(function(){{$find(""{0}"").update(rawProgressData);}});", rpaInit.ClientID, writer.GetStringBuilder().ToString())
  
        ClientScript.RegisterStartupScript(Me.[GetType](), "", strScript, True)
  
  
    End Sub
    Private Sub btnInitialize_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInitialize.Click
        Dim progressContext As RadProgressContext = RadProgressContext.Current
    
        rpaInit.DisplayCancelButton = False
  
        UpdateProgressMessage(progressContext, "Initialization started...", 0)
  
        System.Threading.Thread.Sleep(2000) 'delay it a couple seconds
  
        UpdateProgressMessage(progressContext, "Loading Stuff...", 25)
  
        System.Threading.Thread.Sleep(4000)
  
        UpdateProgressMessage(progressContext, "Loading More Stuff...", 50)
  
        System.Threading.Thread.Sleep(5000)
  
        UpdateProgressMessage(progressContext, "Loading Even More Stuff...", 75)
  
        System.Threading.Thread.Sleep(5000)
  
        progressContext.OperationComplete = True
  
        UpdateProgressMessage(progressContext, "Initialization Complete", 100)
  
    End Sub

Paul J
Top achievements
Rank 1
 answered on 03 Jan 2011
2 answers
87 views
I am using the RadCalendar, I need to Edit the displayed values. I displayed 3 values on a particular date, After entering the values need to update those values. what i should to do?
Brown
Top achievements
Rank 1
 answered on 03 Jan 2011
1 answer
137 views
Hello everybody,

First, I want to apologize for my poor english.
I'm trying to fill a asyncupload when the page loads.
The page in question is made to modify a Business Object and I want when the page load that the asyncupload is filled if a file has already been uploaded for this BO.
If it's not clear tell me in order to explain this better.
Genady Sergeev
Telerik team
 answered on 03 Jan 2011
3 answers
184 views
Hello, yes, I know the problem is overdiscussed, but I tried all the workarounds proposed by you, still doesn't work for me..

I set ReloadOnShow = false, put the code do disable cash in PreRender handler :

Response.Cache.SetCacheability(

HttpCacheability.NoCache);
Response.Cache.SetNoServerCaching();
Response.Cache.SetNoStore();
Response.AppendHeader(
"Pragma", "no-cache");
Response.Expires = -1;
Response.CacheControl =
"no-cache";

But the page still loads twice.

 

Georgi Tunev
Telerik team
 answered on 03 Jan 2011
2 answers
94 views
I have a grid that I would like to "remember" selected items (checkbox) when the user sorts the grid.  I found an article that shows how to do it client side (http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html) - as I want to avoid a postback every time they select an item.  It works very nicely - as long as the selected item in on the current page they are viewing.  If there are more than one page of records (ie showing 10 out of 200) - and the selected record is sorted to the end of the list and doesn't show, it forgets that it was checked.  The on row created doesn't seem to fire as the row really isn't created.  Is there a way around this?

Thank you in advance,
John

John
Top achievements
Rank 1
 answered on 03 Jan 2011
3 answers
184 views

I have a radgrid where I am exporting to Excel.
The RadprogressBarArea increments just fine to 99 percent then stops. (CommandItemTemplate imagebutton click event fires the export process)
After a moment the open,save or cancel window opens for the excel export process..
I save save it or etc...
The progress area never goes away.
Someone suggested reloading the page (not an option).
I have looked at various java script options and other forum post,  but I am having problems following them.

Anyone else run across this and know of a good link?

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/NoNav.Master" AutoEventWireup="true" 
    CodeBehind="Sites.aspx.cs" Inherits="TIPWebIT.SiteManagement.Sites" %> 
 
<%@ Register TagPrefix="custom" Namespace="TIPWebCommon.FilteringTemplateColumns" 
    Assembly="TIPWebIT" %> 
<%@ MasterType TypeName="TIPWebCommon.MasterPages.HayesMasterPage" %> 
<%@ Register Src="SiteDetails.ascx" TagName="SiteDetails" TagPrefix="uc1" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
 
        <script type="text/javascript">  
             
            function RequestStarted(ajaxManager, eventArgs) {  
                if (eventArgs.EventTarget.indexOf("ExportToExcel") != -1) {  
                    eventArgs.EnableAjax = false;  
                }  
            }  
            function OpenWindow(windowName) {  
                window.radopen("", windowName);  
            }  
 
            function Refresh(windowName) {  
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(windowName);  
            }  
 
            function ClosedRadWindowSiteType() {  
                Refresh("RadWindowSiteType");  
            }  
        </script> 
 
    </telerik:RadCodeBlock> 
    <telerik:RadGrid ID="RadGridSites" runat="server" DataSourceID="LdsSites" GridLines="None" 
        AutoGenerateColumns="False" AllowFilteringByColumn="True" AllowPaging="True" 
        AllowSorting="True" OnItemCommand="RadGridSites_ItemCommand" OnItemCreated="RadGridSites_ItemCreated" 
        OnPreRender="RadGridSites_PreRender" OnItemDataBound="RadGridSites_ItemDataBound">  
        <MasterTableView DataKeyNames="SiteUID" DataSourceID="LdsSites">  
            <CommandItemTemplate> 
                <div class="HeaderLeft">  
                    <table> 
                        <tr> 
                            <td> 
                                <asp:ImageButton runat="server" ID="ImageButtonAddRecord" ToolTip="Add Record" AlternateText="Add Record" 
                                    CommandName="InitInsert" /> 
                            </td> 
                            <td> 
                                <asp:LinkButton runat="server" ID="LinkButtonAddRecord" Text="Add Record" CommandName="InitInsert" /> 
                            </td> 
                            <td> 
                                <asp:CheckBox ID="CheckShowInactive" runat="server" EnableViewState="true" AutoPostBack="True" 
                                    OnCheckedChanged="CheckShowInactive_CheckedChanged" /> 
                            </td> 
                            <td> 
                                <asp:LinkButton ID="LinkButtonShowInactive" runat="server" Text="Show Inactive" OnClick="CheckShowInactive_CheckedChanged" /> 
                            </td> 
                        </tr> 
                    </table> 
                </div> 
                <div class="HeaderRight">  
                    <table> 
                        <tr> 
                            <td> 
                                <asp:ImageButton ID="ExportToExcel" runat="server" OnClick="ExportClick" CommandName="ExportToExcel" CssClass="rgExpXLS"/>  
                            </td> 
                            <td> 
                                <asp:ImageButton runat="server" ID="ImageButtonRefresh" ToolTip="Refresh" AlternateText="Refresh" 
                                    CommandName="RebindGrid" /> 
                            </td> 
                            <td> 
                                <asp:LinkButton runat="server" ID="LinkButtonRefresh" Text="Refresh" CommandName="RebindGrid" /> 
                            </td> 
                        </tr> 
                    </table> 
                </div> 
            </CommandItemTemplate> 
            <NestedViewTemplate> 
                <asp:Panel ID="PanelNestedView" runat="server" CssClass="EditFormTabs">  
                    <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">  
                        <Tabs> 
                            <telerik:RadTab runat="server" Text="Site Details">  
                            </telerik:RadTab> 
                        </Tabs> 
                    </telerik:RadTabStrip> 
                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">  
                        <telerik:RadPageView runat="server" ID="PageView1">  
                            <uc1:SiteDetails ID="SiteDetails1" runat="server" /> 
                        </telerik:RadPageView> 
                    </telerik:RadMultiPage> 
                </asp:Panel> 
            </NestedViewTemplate> 
            <EditFormSettings UserControlName="SiteDetails.ascx" EditFormType="WebUserControl">  
                <EditColumn UniqueName="EditCommandColumn1">  
                </EditColumn> 
            </EditFormSettings> 
            <ExpandCollapseColumn Visible="True">  
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">  
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridTemplateColumn AutoPostBackOnFilter="True" DataField="SiteID" HeaderText="Site ID" 
                    SortExpression="SiteID" UniqueName="SiteID" CurrentFilterFunction="StartsWith" 
                    ShowFilterIcon="False">  
                    <ItemTemplate> 
                        <asp:Label ID="SiteIDLabel" runat="server" Text='<%# Eval("SiteID") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="SiteName" AutoPostBackOnFilter="true" HeaderText="Site Name" 
                    SortExpression="SiteName" UniqueName="SiteName" ShowFilterIcon="False">  
                    <ItemTemplate> 
                        <asp:Label ID="SiteNameLabel" runat="server" Text='<%# Eval("SiteName") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="Contact" HeaderText="Contact" SortExpression="Contact" 
                    UniqueName="Contact" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" 
                    ShowFilterIcon="False">  
                    <ItemTemplate> 
                        <asp:Label ID="ContactLabel" runat="server" Text='<%# Eval("Contact") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="Phone" HeaderText="Phone" SortExpression="Phone" 
                    UniqueName="Phone" Visible="true" AutoPostBackOnFilter="true" EditFormColumnIndex="1" 
                    ShowFilterIcon="False">  
                    <ItemTemplate> 
                        <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="Email" HeaderText="Email" SortExpression="Email" 
                    UniqueName="Email" Visible="False" AutoPostBackOnFilter="true" EditFormColumnIndex="1" 
                    ShowFilterIcon="False">  
                    <ItemTemplate> 
                        <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <custom:FilteringColumn UniqueName="Name" SortExpression="Name" DataField="Name" 
                    TableName="LdsSiteTypes" HeaderText="Site Type" ShowFilterIcon="false">  
                    <ItemTemplate> 
                        <asp:Label ID="SiteTypeNameLabel3" runat="server" Text='<%# Eval("Name") %>'></asp:Label> 
                    </ItemTemplate> 
                </custom:FilteringColumn> 
                <custom:FilteringColumn UniqueName="RegionName" SortExpression="RegionName" DataField="RegionName" 
                    TableName="LdsRegions" HeaderText="Region" ShowFilterIcon="false">  
                    <ItemTemplate> 
                        <asp:Label ID="RegionNameLabel3" runat="server" Text='<%# Eval("RegionName") %>'></asp:Label>&nbsp;  
                    </ItemTemplate> 
                </custom:FilteringColumn> 
                <telerik:GridButtonColumn UniqueName="TransferColumn" HeaderText="Transfer" CommandName="Transfer" 
                    ButtonType="ImageButton" Text="Transfer" ImageUrl="~/Images/Transfer.gif">  
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridButtonColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" /> 
     <telerik:RadProgressArea ID="RadProgressArea1" Runat="server"   
        CssClass="Progress" DisplayCancelButton="True" Skin="WebBlue" > 
<Localization Uploaded="Uploaded"></Localization> 
    </telerik:RadProgressArea> 
    <br /> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
        <Windows> 
            <telerik:RadWindow ID="RadWindowSiteType" runat="server" Behavior="Resize, Close" 
                InitialBehavior="None" Modal="True" NavigateUrl="SiteTypes.aspx" Title="Edit Site Types" 
                OnClientClose="ClosedRadWindowSiteType">  
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">  
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest" 
        ClientEvents-OnRequestStart="RequestStarted">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGridSites" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadGridSites">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGridSites" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <asp:HiddenField ID="HiddenFieldShowInactive" runat="server" Value="False" /> 
    <asp:LinqDataSource ID="LdsSites" runat="server" ContextTypeName="TIPWebITLibrary.DAL.TIPWebITDataContext" 
        TableName="VTechSites" Where="Active != @Active">  
        <WhereParameters> 
            <asp:ControlParameter ControlID="HiddenFieldShowInactive" DefaultValue="False" Name="Active" 
                PropertyName="Value" Type="Boolean" /> 
        </WhereParameters> 
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="LdsSiteTypes" runat="server" ContextTypeName="TIPWebITLibrary.DAL.TIPWebITDataContext" 
        Select="new (Name, Description, SiteTypeUID)" TableName="tblTechSiteTypes" OrderBy="Name">  
    </asp:LinqDataSource> 
    <asp:LinqDataSource ID="LdsRegions" runat="server" ContextTypeName="TIPWebITLibrary.DAL.TIPWebITDataContext" 
        Select="new (RegionName, RegionDesc, RegionID)" TableName="tblRegions" Where="RegionID > 0" 
        OrderBy="RegionName">  
    </asp:LinqDataSource> 
</asp:Content> 
 



 
 
 
 
 
using System;  
using System.Globalization;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.Web.UI;  
 
namespace TIPWebIT.SiteManagement  
{  
    public partial class Sites : System.Web.UI.Page  
    {  
        protected void Page_Unload(object sender, EventArgs e)  
        {  
            if (Session["rcbRegionValue"] != null)  
            {  
                Session.Remove("rcbRegionValue");  
            }  
        }  
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Page.IsPostBack)  
            {  
                Master.HeaderImagePath = "~/Images/user.gif";  
                Master.HeaderText = "Site Management";  
            }  
            TIPWebITLibrary.BLL.UserManagement.User oUser = null;  
            oUser = this.Master.SessionUser;  
            if (oUser.UserRoleUID == 2)  
            {  
                ((GridEditCommandColumn)RadGridSites.MasterTableView.Columns.FindByUniqueName("EditCommandColumn")).EditImageUrl = "~/App_Themes/" + Page.Theme + "/Grid/Edit.gif";  
            }  
            else  
            {  
                ((GridEditCommandColumn)RadGridSites.MasterTableView.Columns.FindByUniqueName("EditCommandColumn")).Visible = false;  
            }  
 
            RadProgressArea1.Localization.Uploaded = "Total Progress";  
            RadProgressArea1.Localization.UploadedFiles = "Progress";  
            RadProgressArea1.Localization.CurrentFileName = "Custom progress in action: ";  
 
        }  
 
        protected void RadGridSites_ItemCreated(object sender, GridItemEventArgs e)  
        {  
 
 
            if (e.Item is GridCommandItem)  
            {  
                TIPWebITLibrary.BLL.UserManagement.User oUser = null;  
                oUser = this.Master.SessionUser;  
                if (oUser.UserRoleUID == 2)  
                {  
                    ((ImageButton)e.Item.FindControl("ImageButtonAddRecord")).ImageUrl = "~/App_Themes/" + Page.Theme + "/Grid/AddRecord.gif";  
                }  
                else  
                {  
                    ((ImageButton)e.Item.FindControl("ImageButtonAddRecord")).Visible = false;  
                    ((LinkButton)e.Item.FindControl("LinkButtonAddRecord")).Visible = false;  
                }  
                ((ImageButton)e.Item.FindControl("ImageButtonRefresh")).ImageUrl = "~/App_Themes/" + Page.Theme + "/Grid/Refresh.gif";  
                if (this.HiddenFieldShowInactive.Value == "True")  
                {  
                    ((CheckBox)e.Item.FindControl("CheckShowInactive")).Checked = true;  
                }  
            }  
 
 
            //RadProgressContext context = RadProgressContext.Current;  
            //if (e.Item.ItemIndex > 0)  
            //{  
            //    context.PrimaryPercent = e.Item.ItemIndex.ToString();  
 
            //    context.SecondaryValue = e.Item.ItemIndex.ToString();  
            //    context.CurrentOperationText = "Creating items...";  
 
 
            //}  
        }  
 
        protected void RadGridSites_ItemCommand(object source, GridCommandEventArgs e)  
        {  
            if (ViewState["CheckStatus"] != null)  
            {  
                if (Convert.ToBoolean(ViewState["CheckStatus"], CultureInfo.InvariantCulture))  
                {  
                    this.HiddenFieldShowInactive.Value = "True";  
                }  
                else  
                {  
                    this.HiddenFieldShowInactive.Value = "False";  
                }  
            }  
            GridDataItem selectedItem = null;  
            switch (e.CommandName)  
            {  
                case "Update":  
                case "PerformInsert":  
                    e.Canceled = true;  
                    break;  
                case "RebindGrid":  
                    this.RadGridSites.MasterTableView.FilterExpression = string.Empty;  
 
                    foreach (GridColumn column in RadGridSites.MasterTableView.Columns)  
                    {  
                        column.CurrentFilterValue = string.Empty;  
                        Session.Remove("rcbRegionValue");  
                    }  
                    foreach (GridDataItem item in this.RadGridSites.Items)  
                    {  
                        item.Expanded = false;  
                    }  
                    this.RadGridSites.MasterTableView.ClearEditItems();  
                    break;  
                case "Edit":  
                    this.RadGridSites.MasterTableView.IsItemInserted = false;  
                    break;  
                case "InitInsert":  
                    this.RadGridSites.MasterTableView.ClearEditItems();  
                    break;  
                case "Filter":  
                    foreach (GridDataItem item in this.RadGridSites.Items)  
                    {  
                        item.Expanded = false;  
                    }  
                    this.RadGridSites.MasterTableView.ClearEditItems();  
                    break;  
                case "ExpandCollapse":  
                    selectedItem = (GridDataItem)e.Item;  
                    if (selectedItem.Expanded)  
                    {  
                        //Collapsing  
                        selectedItem.Selected = false;  
                    }  
                    else  
                    {  
                        //Expanding  
                        foreach (GridDataItem item in this.RadGridSites.Items)  
                        {  
                            item.Expanded = false;  
                        }  
                        this.RadGridSites.MasterTableView.ClearEditItems();  
                        this.RadGridSites.MasterTableView.ClearSelectedItems();  
                        selectedItem.Selected = true;  
                    }  
                    break;  
                case "RowClick":  
                    selectedItem = (GridDataItem)e.Item;  
                    if (selectedItem.Expanded)  
                    {  
                        selectedItem.Selected = false;  
                        selectedItem.Expanded = false;  
                    }  
                    else  
                    {  
                        foreach (GridDataItem item in this.RadGridSites.Items)  
                        {  
                            item.Expanded = false;  
                        }  
                        this.RadGridSites.MasterTableView.ClearEditItems();  
                        this.RadGridSites.MasterTableView.ClearSelectedItems();  
                        selectedItem.Selected = true;  
                        selectedItem.Expanded = true;  
                    }  
                    break;  
            }  
        }  
 
        protected void CheckShowInactive_CheckedChanged(object sender, EventArgs e)  
        {  
            CheckBox checkStatus;  
            LinkButton linkButtonSender = sender as LinkButton;  
            if (linkButtonSender != null)  
            {  
                checkStatus = (CheckBox)linkButtonSender.Parent.FindControl("CheckShowInactive");  
                if (checkStatus.Checked)  
                {  
                    checkStatus.Checked = false;  
                }  
                else  
                {  
                    checkStatus.Checked = true;  
                }  
            }  
            else  
            {  
                checkStatus = (CheckBox)sender;  
            }  
            if (checkStatus.Checked)  
            {  
                ViewState["CheckStatus"] = "true";  
                this.HiddenFieldShowInactive.Value = "True";  
            }  
            else  
            {  
                ViewState["CheckStatus"] = "false";  
                this.HiddenFieldShowInactive.Value = "False";  
            }  
            RadGridSites.MasterTableView.ClearEditItems();  
        }  
 
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
        {  
            if (e.Argument == "RadWindowSiteType")  
            {  
                if (RadGridSites.MasterTableView.IsItemInserted == true)  
                {  
                    SiteDetails mySiteDetails = (SiteDetails)RadGridSites.MasterTableView.GetInsertItem().FindControl(GridEditFormItem.EditFormUserControlID);  
                    if (e.Argument == "RadWindowSiteType")  
                    {  
                        RadComboBox ddlSiteTypes = (RadComboBox)mySiteDetails.FindControl("SiteTypeUIDDropDownList");  
                        ddlSiteTypes.Items.Clear();  
                        ddlSiteTypes.Items.Add(new RadComboBoxItem("", ""));  
                        ddlSiteTypes.DataBind();  
                    }  
                }  
                else  
                {  
                    RadGridSites.MasterTableView.Rebind();  
                }  
            }  
        }  
 
        protected void RadGridSites_PreRender(object sender, EventArgs e)  
        {  
            if (ViewState["CheckStatus"] != null)  
            {  
                GridItem commandItem = RadGridSites.MasterTableView.GetItems(GridItemType.CommandItem)[0];  
                CheckBox checkBox = (CheckBox)commandItem.FindControl("CheckShowInactive");  
                if (ViewState["CheckStatus"].ToString() == "true")  
                {  
                    checkBox.Checked = true;  
                    this.HiddenFieldShowInactive.Value = "True";  
                }  
                else  
                {  
                    checkBox.Checked = false;  
                    this.HiddenFieldShowInactive.Value = "False";  
                }  
            }  
            ((GridTemplateColumn)this.RadGridSites.MasterTableView.Columns.FindByUniqueName("SiteID")).CurrentFilterFunction = GridKnownFunction.StartsWith;  
            ((GridTemplateColumn)this.RadGridSites.MasterTableView.Columns.FindByUniqueName("Contact")).CurrentFilterFunction = GridKnownFunction.StartsWith;  
        }  
 
        protected void RadGridSites_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridPagerItem)  
            {  
                RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");  
                PageSizeCombo.Items.Clear();  
                PageSizeCombo.Items.Add(new RadComboBoxItem("20"));  
                PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", RadGridSites.MasterTableView.ClientID);  
                PageSizeCombo.Items.Add(new RadComboBoxItem("50"));  
                PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", RadGridSites.MasterTableView.ClientID);  
                PageSizeCombo.Items.Add(new RadComboBoxItem("100"));  
                PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", RadGridSites.MasterTableView.ClientID);  
                PageSizeCombo.Items.Add(new RadComboBoxItem("250"));  
                PageSizeCombo.FindItemByText("250").Attributes.Add("ownerTableViewId", RadGridSites.MasterTableView.ClientID);  
                PageSizeCombo.Items.Add(new RadComboBoxItem("300"));  
                PageSizeCombo.FindItemByText("300").Attributes.Add("ownerTableViewId", RadGridSites.MasterTableView.ClientID);  
                PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString(CultureInfo.InvariantCulture)).Selected = true;  
            }  
 
            //RadProgressContext context = RadProgressContext.Current;  
            //if (e.Item.ItemIndex > 0)  
            //{  
            //    context.SecondaryValue = e.Item.ItemIndex.ToString();  
            //    context.CurrentOperationText = "Creating items...";  
            //}  
        }  
 
        protected void ExportClick(object sender, EventArgs e)  
        {  
            this.RadGridSites.ExportSettings.OpenInNewWindow = true;  
            this.RadGridSites.ExportSettings.ExportOnlyData = true;  
            this.RadGridSites.ExportSettings.IgnorePaging = true;  
            UpdateProgressContext();  
 
            this.RadGridSites.MasterTableView.ExportToExcel();  
            this.RadProgressArea1.Visible = false;  
 
 
        }  
        //protected override void OnPreRenderComplete(EventArgs e)  
        //{  
        //    //http://www.telerik.com/community/forums/aspnet-ajax/grid/display-loading-panel-during-export.aspx  
        //    //http://demos.telerik.com/aspnet-ajax/upload/examples/customprogress/defaultcs.aspx?RadUrid=17ff8ea5-9104-4925-9c26-54b91de34242  
        //    //if (this.RadGridSites.MasterTableView.Items.Count > 100)  
        //    //{  
        //    RadProgressContext context = RadProgressContext.Current;  
        //    context.CurrentOperationText = "Sending to client...";  
        //    context["ProgressDone"] = true;  
        //    context.OperationComplete = true;  
 
        //    base.OnPreRenderComplete(e);  
        //    //}  
 
 
 
        //}  
 
        private void UpdateProgressContext()  
        {  
            const int total = 100;  
 
            RadProgressContext progress = RadProgressContext.Current;  
            progress.Speed = "N/A";  
 
            for (int i = 0; i < total; i++)  
            {  
                progress.PrimaryTotal = 1;  
                progress.PrimaryValue = 1;  
                progress.PrimaryPercent = 100;  
 
                progress.SecondaryTotal = total;  
                progress.SecondaryValue = i;  
                progress.SecondaryPercent = i;  
 
                progress.CurrentOperationText = "Step " + i.ToString();  
 
                if (!Response.IsClientConnected)  
                {  
                    //Cancel button was clicked or the browser was closed, so stop processing  
                    break;  
                }  
 
                progress.TimeEstimated = (total - i) * 100;  
                //Stall the current thread for 0.1 seconds  
                System.Threading.Thread.Sleep(100);  
            }  
        }  
 
    }  
}  
 
Genady Sergeev
Telerik team
 answered on 03 Jan 2011
0 answers
108 views
Hi, 
I have some questions regarding toolbar in MOSSradEditor.
1. When the MOSSRadEditor is the only control on the page, or for any other reason has the focus as soon as it is loaded the toolbar is always shown, even when the editor is set to have only the preview mode:

editorPreview.EditModes = EditModes.Preview;

Adding the following client-side script doesn't help either:

    <script type="text/javascript" language="javascript">
        function Editor_ClientLoad(editor, args) {
            editor.set_mode(4);
            editor.set_editable(false);
            editor.enableEditing(false);
        }
   </script>

What is your suggestion to solve this issue?

2. I would like to make some toolbar buttons invisible as soon as the editor is selected, hence the toolbar is shown. I use the following client side code:
        function Editor_ClientLoad(editor, args) {
            editor.attachEventHandler("onmousedown", function(e) {
        var oTool = this.Editor.getToolByName("buttonName"); //get a reference to the custom tool
        if (oTool == null)
            return;
        oTool.set_visible(false); 
            });
}
After the first mouse click, toolbar buttons are not yet accessible, in other words oTool==null. After the second click it works fine.
How can I solve this problem, Can you suggest a better way to get the same results?

3. If there are two or more toolbars defined for a single editor, how can we get a reference to the toolbar causing the client side event "OnClientCommandExecuting" in the corresponding evand handler?

I appreciate your reponse.
Regards,
Ali.
Ali
Top achievements
Rank 1
 asked on 03 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?