Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
152 views
I've noteced, that RadAjaxManager works only in Google Chrome, Mozilla Firefox 7.0.1, but does not work neither in IE9, nor in Safari or may be even more browser.
I'd like to ask, if there is any work around or this control is not designed to support popular browsers. Or is there any mistakes in my code.

I have a Master page, Web user control and Web form page. Here is the code to reproduce bug.

Master page
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="RAM.Site" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register src="WebUserControl.ascx" tagname="WebUserControl" tagprefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                </Scripts>
            </telerik:RadScriptManager>
            <telerik:RadAjaxManager runat="server" ID="RadAjaxManager" onajaxrequest="RadAjaxManager_AjaxRequest">
                <AjaxSettings>
                    <telerik:AjaxSetting>
                    </telerik:AjaxSetting>
                </AjaxSettings>       
            </telerik:RadAjaxManager>
            <asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
                <ContentTemplate>               
                    <uc:WebUserControl ID="WebUserControl1" runat="server" />               
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">       
            </asp:ContentPlaceHolder>
        </div>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
 
                function doAjaxRequest() {
                    $find("<%= RadAjaxManager.ClientID %>").ajaxRequest("AddNumber");
                    var UpdatePanel = '<%= UpdatePanel.ClientID %>';
                    __doPostBack(UpdatePanel, '');
                    return false;
                }
 
            </script>
        </telerik:RadCodeBlock>  
    </form>
</body>
</html>

Master page code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace RAM
{
    public partial class Site : System.Web.UI.MasterPage
    {
        private int _number;
        public int Number
        {
            get
            {
                if (Session["Number"] != null)
                    _number = (int)Session["Number"];
                else _number = 0;
                return _number;
            }
            set
            {
                Session["Number"] = value;
            }
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Session["Number"] = Number;           
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
              
        }
 
        protected void RadAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            if (e.Argument.StartsWith("Add"))
            {
                Number++;
            }
        }
    }
}

Web User Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl.ascx.cs" Inherits="RAM.WebUserControl" %>
<asp:Label ID="Label" runat="server" Text="---"></asp:Label>

Web User Control code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace RAM
{
    public partial class WebUserControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Label.Text = (Page.Master as Site).Number.ToString();
        }
    }
}

Web Form:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebForm.aspx.cs" Inherits="RAM.WebForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Button ID="Button" runat="server" Text="Increase number" OnClientClick="doAjaxRequest(); return false;" />
</asp:Content>


Maria Ilieva
Telerik team
 answered on 14 Feb 2012
3 answers
252 views
Hi,

Here I need to set radmenu fit to screen (browser). Please assist me how can I achieve it? My Menu binding is dynamic from database.

ref. http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/scrolling/defaultcs.aspx

What I have tried (As below):

JavaScript:

<script type="text/javascript">
        function pageLoad() {
            var menu = $find("<%= RadMenu1.ClientID %>");
            debugger;
            var menuWid = getWindowWidth() + "px";
            menu.offsetWidth = menuWid;
            menu._element.offsetParent.clientWidth = menuWid;
            menu._element.offsetParent.scrollWidth = getWindowWidth() - 100 + "px";
            menu.repaint();
        }
        window.onresize = pageLoad;
 
        function getWindowWidth() {
            var windowWidth = 0;
            if (typeof (window.innerWidth) == 'number') {
                windowWidth = window.innerWidth;
            }
            else {
                if (document.documentElement && document.documentElement.clientWidth) {
                    windowWidth = document.documentElement.clientWidth;
                }
                else {
                    if (document.body && document.body.clientWidth) {
                        windowWidth = document.body.clientWidth;
                    }
                }
            }
            return windowWidth;
        }
    </script>

HTML:

<telerik:RadMenu ID="RadMenu1" runat="server" EnableRootItemScroll="true" width="100%"
        EnableRoundedCorners="true">
        <Items>
            <telerik:RadMenuItem Text="Arial" />
            <telerik:RadMenuItem Text="Verdana" />
            <telerik:RadMenuItem Text="Tahoma" />
            <telerik:RadMenuItem Text="Sans-serif" />
            <telerik:RadMenuItem IsSeparator="true" />
            <telerik:RadMenuItem Text="Arial" />
            <telerik:RadMenuItem Text="Arial Black" />
            <telerik:RadMenuItem Text="Arial Narrow" />
            <telerik:RadMenuItem Text="Arial Unicode MS" />
            <telerik:RadMenuItem Text="Bookman Old Style" />
            <telerik:RadMenuItem Text="Bookshelf Symbol 7" />
            <telerik:RadMenuItem Text="Century" />
            <telerik:RadMenuItem Text="Century Gothic" />
            <telerik:RadMenuItem Text="Comic Sans MS" />
            <telerik:RadMenuItem Text="Courier New" />
            <telerik:RadMenuItem Text="Garamond" />
            <telerik:RadMenuItem Text="Georgia" />
            <telerik:RadMenuItem Text="Goudy Old Style" />
            <telerik:RadMenuItem Text="Goudy Stout" />
            <telerik:RadMenuItem Text="Haettenschweiler" />
            <telerik:RadMenuItem Text="Helvetica" />
            <telerik:RadMenuItem Text="Impact" />
            <telerik:RadMenuItem Text="Imprint MT Shadow" />
            <telerik:RadMenuItem Text="Latha" />
            <telerik:RadMenuItem Text="Lucida Console" />
            <telerik:RadMenuItem Text="Lucida Sans" />
            <telerik:RadMenuItem Text="Lucida Sans Typewriter" />
            <telerik:RadMenuItem Text="Lucida Sans Unicode" />
        </Items>
    </telerik:RadMenu>

Thanks & Regards,

Kaushal Jani
Peter
Telerik team
 answered on 14 Feb 2012
1 answer
143 views
Hi,

Am doing mega drop down menu, where the menu items and sub items are driven from XML file.Actually my wish is drop down should not appear if no sub items are present under a menu item.But in this case am getting an empty drop down.Please let me know how to get out of this.

Code snippet is as folows and the following attachment is my xml file.


        protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadMenu1.LoadContentFile("menu3.xml");
            RadMenu1.DataBind();


        }  
    }

protected void RadMenu1_DataBound(object sender, EventArgs e)
    {
        RadMenu menu = (RadMenu)sender;
        menu.Width = 880;
        menu.Height = 35;
        foreach (RadMenuItem item in menu.Items)
        {
            RadSiteMap sm = new RadSiteMap();
            PopulateSiteMap(sm, null, item);   

            //sitemap settings to have the menu items appear in columns

            SiteMapLevelSetting rootLevelSetting = new SiteMapLevelSetting(0);
            rootLevelSetting.ListLayout.RepeatColumns = 1;
            rootLevelSetting.ListLayout.RepeatDirection = SiteMapRepeatDirection.Horizontal;
            sm.LevelSettings.Add(rootLevelSetting);
            item.Items.Clear();
            RadMenuItem childItem = new RadMenuItem();


            childItem.Width = 880;
            Panel catWrapper = new Panel();
            catWrapper.CssClass = "Wrapper";
            catWrapper.Width = Unit.Pixel(870);
            catWrapper.Controls.Add(sm);

            childItem.Controls.Add(catWrapper);
            item.Items.Add(childItem);
        }
    }

 private static void PopulateSiteMap(RadSiteMap sm, RadSiteMapNode node, RadMenuItem item)
    {
        if (node == null)
        {
            foreach (RadMenuItem child in item.Items)
            {
                node = new RadSiteMapNode(child.Text, child.NavigateUrl);             
                sm.Nodes.Add(node);
                if (child.Items.Count > 0)
                {
                    PopulateSiteMap(sm, node, child);
                }
            }
        }
        else
        {
            foreach (RadMenuItem child in item.Items)
            {              
                node.Nodes.Add(new RadSiteMapNode(child.Text, child.NavigateUrl));
                if (child.Items.Count > 0)
                {
                    PopulateSiteMap(sm, node, child);
                }
            }
        }       
    }  

Thanks & Regards
Mohanram Poola
Peter
Telerik team
 answered on 14 Feb 2012
4 answers
574 views
Hi ALL,
       I have done multiple check box selection inside the Radcombobox using Javascript Please have one look it may help you in your project:

JAVASCRIPT:
<script type="text/javascript">
 function onCheckBoxClickClass(chk, combo) {
 
                var combo;
                if (combo == 'rcbClassGroup') {
                    combo = $find("<%= rcbClassGroup.ClientID %>");
                }
 
                cancelDropDownClosing = true;
                //holds the text of all checked items
                var text = "";
                //holds the values of all checked items
                var values = "";
                //get the collection of all items
                var items = combo.get_items();
                //enumerate all items
                for (var i = 0; i < items.get_count(); i++) {
                    var item = items.getItem(i);
                    //get the checkbox element of the current item
                    var chkMultipleSelectclass = $get(combo.get_id() + "_i" + i + "_chkMultipleSelectclass");
                    if (chkMultipleSelectclass.checked) {
                        text += item.get_text() + ",";
                        values += item.get_value() + ",";
                    }
                }
                //remove the last comma from the string
                text = removeLastComma(text);
                values = removeLastComma(values);
 
                if (text.length > 0) {
                    //set the text of the combobox
                    combo.set_text(text);
 
                }
                else {
                    //all checkboxes are unchecked
                    //so reset the controls
                    combo.set_text("");
                }
            }
 
            var cancelDropDownClosing = false;
 
            function removeLastComma(str) {
                return str.replace(/,$/, "");
            }
 
            function StopPropagation(e) {
 
                //cancel bubbling
                e.cancelBubble = true;
                if (e.stopPropagation) {
                    e.stopPropagation();
                }
            }
 
            function onDropDownClosing() {
                cancelDropDownClosing = false;
            }
 
 
 
           function selectAllNodes(chk, combo, chkItem, ChkNone) {
 
                var combo;
                var combobox;
                if (combo == 'rcbClassGroup') {
                    combobox = $find('<%=rcbClassGroup.ClientID %>');
                }
 
 
                var nestedCheckBox = combobox.get_items()._array;
                for (var i = 0; i < nestedCheckBox.length; i++) {
                    var chk1 = $get(combobox.get_id() + "_i" + i + "_" + chkItem);
                    chk1.checked = chk.checked;
                }
                if (chk.checked && combo == 'rcbClassGroup')
                    onCheckBoxClickClass(chk, combo);
 
 
                if (ChkNone != null) {
                    var chkNone = $get(combobox.get_id() + "_Header_" + ChkNone);
                    if (chkNone.checked)
                        chkNone.checked = false;
                }
 
                if (!chk.checked)
                    combobox.set_text("");
 
            }
</script>

HTML:
<telerik:RadComboBox ID="rcbClassGroup" runat="server" AllowCustomText="true" SkinID="DropDownList298x200"
        Filter="Contains" EmptyMessage="--Select--" AutoPostBack="false" DataSourceID="test" DataTextField="Name" DataValueField="ID" >
        <HeaderTemplate>
            <asp:CheckBox ID="ChkClassroomGroup" runat="server" Text="Select All" AutoPostBack="false"
                onClick="selectAllNodes(this,'rcbClassGroup','chkMultipleSelectclass',null)" />
        </HeaderTemplate>
        <ItemTemplate>
            <div onclick="StopPropagation(event)">
                <asp:CheckBox ID="chkMultipleSelectclass" runat="server" Text='<%#Eval("Name") %>'
                    AutoPostBack="false" onclick="onCheckBoxClickClass(this,'rcbClassGroup')" />
            </div>
        </ItemTemplate>
    </telerik:RadComboBox>
    <asp:XmlDataSource ID="test" DataFile="../XMLFiles/RadCombo.xml" runat="server"></asp:XmlDataSource>

Let me know if any issue.

Thanks,
Abhishek K 
Abhishek
Top achievements
Rank 2
 answered on 14 Feb 2012
1 answer
189 views

Hi,

is it possible to place a RadAjaxLoadingPanel inside the master page so it will show on any kind of postback event!? I don't want to attach the RadAjaxLoadingPanel to specific controls like a send button which fire the postback. As for me, it should work on any page using the master page. Is this possible!?

Thanks in advance

Martin

Abhishek
Top achievements
Rank 2
 answered on 14 Feb 2012
3 answers
85 views
For the following control definition, I am not getting an initial filter expression passed to the WCF GetDataAndCount method.  The initial filter expression is empty.  If I set a filter after the grid is loaded, then the call to GetDataAndCount is passed a filter expression.  I am following the example at http://www.telerik.com/help/aspnet-ajax/grid-applying-default-filter-on-initial-load.html.


<telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="True"
            AllowFilteringByColumn="True" PageSize="40" CellSpacing="0"
            GridLines="None" Skin="Office2010Blue" AutoGenerateColumns="False"
            EnableViewState="False" EnableLinqExpressions="false" >
            <MasterTableView DataKeyNames="ProductID" ClientDataKeyNames="ProductID"
                EnableViewState="False" FilterExpression="([Staus] <> 'Closed')">
                <PagerStyle Mode="NumericPages" />
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="Number" HeaderText="Number" DataType="System.Int32" HeaderStyle-Width="50px">
                        <HeaderStyle Width="50px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Type" HeaderText="Type" DataType="System.Int32" HeaderStyle-Width="75px">
                        <HeaderStyle Width="75px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Subject" HeaderText="Subject" DataType="System.String" ItemStyle-Wrap="False" FilterControlWidth="150px">
                        <HeaderStyle Width="150px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Status" HeaderText="Status" DataType="System.String" CurrentFilterFunction="NotEqualTo" CurrentFilterValue="Closed">
                        <HeaderStyle Width="75px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" DataType="System.String">
                        <HeaderStyle Width="75px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="CreationDate" HeaderText="Creation Date" PickerType="None" DataType="System.DateTime" DataFormatString="{0:M/d/yyyy h:mm tt}" ItemStyle-Wrap="False">
                        <HeaderStyle Width="200px"></HeaderStyle>
                    </telerik:GridDateTimeColumn>
                </Columns>

                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                </EditFormSettings>

                <PagerStyle Mode="NextPrevAndNumeric" />
            </MasterTableView>
            <ClientSettings>
                <DataBinding SelectMethod="GetDataAndCount" Location="Ajax" SortParameterType="String" FilterParameterType="String">
                </DataBinding>
                <Selecting AllowRowSelect="True" />
                <ClientEvents OnRowDataBound="rowBound" />
            </ClientSettings>
            <FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
Tsvetina
Telerik team
 answered on 14 Feb 2012
1 answer
68 views
I have a grid in which I have filtering as well as paging turned on.

When I am filtering the the grid based on a particular column, the rows which are matching in the current page are showing up in the filter result but the rows which are matching in the other pages of the grid are not comming in the filter result and I want them to come up in the result of the filter. Unable to do so.

Please help me out.
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
1 answer
180 views
I am using the below sample to build a listview image gallery.

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/listviewsliderwindowrotator/defaultcs.aspx?product=listview

I am getting the Out of Memory exception. I have attached the code and error.

Would you please help me with this problem.
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Linq
Imports System.Web
Imports System.Drawing
Imports System.Threading
  
Namespace Data
    Public NotInheritable Class DataProvider
        Private Sub New()
        End Sub
        <ThreadStatic()> Private Shared _photos As List(Of Photo)
  
        Public Shared Function GetData() As IList(Of Photo)
            If _photos IsNot Nothing Then
                Return _photos
            End If
  
            _photos = New List(Of Photo)()
            For Each file As String In Directory.GetFiles(HttpContext.Current.Server.MapPath("Res1\User1\Residence1\"))
                Dim photo = New Photo()
                photo.Name = Path.GetFileName(file)
  
                Dim image__1 As Image = Image.FromFile(file)
                Using memoryStream = New MemoryStream()
                    image__1.Save(memoryStream, ImageFormat.Png)
                    photo.Data = memoryStream.ToArray()
                End Using
                _photos.Add(photo)
            Next
            Return _photos
        End Function
  
    End Class
  
    Public Class Photo
        Private Shared ReadOnly _key As New Object()
        <ThreadStatic()> Private Shared _counter As Integer
  
        Public Sub New()
            Id = GetId()
        End Sub
  
        Public Property Name() As String
            Get
                Return m_Name
            End Get
            Set(ByVal value As String)
                m_Name = value
            End Set
        End Property
        Private m_Name As String
        Public Property Data() As Byte()
            Get
                Return m_Data
            End Get
            Set(ByVal value As Byte())
                m_Data = value
            End Set
        End Property
        Private m_Data As Byte()
        Public Property Id() As Integer
            Get
                Return m_Id
            End Get
            Private Set(ByVal value As Integer)
                m_Id = value
            End Set
        End Property
        Private m_Id As Integer
  
        Protected Shared Function GetId() As Integer
            SyncLock _key
                _counter += 1
            End SyncLock
            Return _counter
        End Function
    End Class
End Namespace

Veli
Telerik team
 answered on 14 Feb 2012
8 answers
173 views
I understand why ExcelML export doesn't work on TemplateColumns out of the box, but it would be nice if you placed somewhere on the top of your ExcelML documentation something like "Limitation: this will not work with TemplateColumns". I would rather know there is a limitation than spending time trying to figure out why the control won't work the way I expected.

Furthermore, I have seen numerous posts about this issue (many of which would likely be unecessary with the little bit of additional documentaiton I mentioned above) and most of these point to a link which no longer exists ("Export Tips and tricks"), claiming there is some way to get the ExcelML export to work with template columns. So my question, since there doesn't seem to be any documentation, is do you have a work-around to be able to get template columns to export in an ExcelML scenario? If so, can you provide a VB example?
Mira
Telerik team
 answered on 14 Feb 2012
1 answer
97 views
What is the client event for getting the selected text in combobox
aspx
<telerik:RadComboBox ID="RadComboBox1" runat="server" Height="300px" >
         <Items>
                <telerik:RadComboBoxItem Text="Room1" />
                 <telerik:RadComboBoxItem Text="Room2" />
</Items>
        </telerik:RadComboBox>
Princy
Top achievements
Rank 2
 answered on 14 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?