Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
169 views
01.<telerik:RadMenu runat="server" Skin="Menu_New" ID="RadMainMenu" Style="z-index: 5" ExpandDelay="1000"
02.    DataSourceID="SqlDataSourceMainMenu" DataFieldID="Id" DataFieldParentID="ParentId" DataTextField="Text"
03.    EnableRoundedCorners="true" EnableEmbeddedSkins="false" EnableShadows="true"
04.    OnItemDataBound="RadMainMenu_ItemDataBound" OnItemClick="RadMainMenu_ItemClick">
05. 
06.    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
07. 
08.    <DefaultGroupSettings RepeatColumns="3" RepeatDirection="Horizontal" />
09. 
10.</telerik:RadMenu>

I added the "DefaultGroupSettings" line and yes, every menu option was now a 3 bar menu. However, I need to be able to apply this to the menu options that actually have more than  "x" items in them.


Any help with this would be greatly appreciated.


Thanks,
Ivan Zhekov
Telerik team
 answered on 16 Sep 2014
2 answers
187 views
Trying to get my Radgrid to perform updates of records but have not been able to. I have been following this article(http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/manual-crud-operations/defaultcs.aspx?#qsf-demo-source) but because I am using content placeholders etc. can't follow it exactly. Below is my code, any suggestions on how to get the update to work would be appreciated. When I run the page, it just displays the data in the grid, the pencil icon does not show up to update. Any ideas?

Attached is the design and code behind.

Code Behind
01.using System;
02.using System.Collections.Generic;
03.using System.Linq;
04.using System.Web;
05.using System.Web.UI;
06.using System.Web.UI.WebControls;
07.using Business.Admin;
08.using Telerik.Web.UI;
09. 
10.namespace XX.Admin
11.{
12.    public partial class AdminLookUp : System.Web.UI.Page
13.    {
14.        protected void Page_Load(object sender, EventArgs e)
15.        {
16.            //if (!IsPostBack)
17.            //{
18.            //    LoadData();
19.            //}
20.        }
21. 
22.        public void LoadData(object source, GridNeedDataSourceEventArgs e)
23.        {
24.            //load data for lookup grid
25.            AdminLookUpBO lookUp = new AdminLookUpBO();
26.            List<AdminLookUpVO> getLookUpData;
27. 
28.            getLookUpData = lookUp.GetLookUpData();
29. 
30.            AdminLookUpGrid.DataSource = getLookUpData;
31.        }
32. 
33.        protected void goBackButton_Click(object sender, EventArgs e)
34.        {
35.            Response.Redirect("~/Admin/AdminMain.aspx");
36.        }
37. 
38. 
39.        protected void UpdateData(object source, GridCommandEventArgs e)
40.        {
41.               //update data for lookup grid
42.            AdminLookUpBO lookup = new AdminLookUpBO();
43. 
44.            var editableItem = ((GridEditableItem)e.Item);
45.            int lookUpId = (int)editableItem.GetDataKeyValue("ID");
46.            bool result = false;
47. 
48.            result = lookup.UpdateData(lookUpId, editableItem);
49.           
50.        }
51. 
52. 
53.    }
54.}


001.<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AdminLookUp.aspx.cs" Inherits="XX.Admin.AdminLookUp" %>
002.<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
003.<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
004.        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
005.        <script type="text/javascript">
006.            function rowDblClick(sender, eventArgs) {
007.                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
008.            }
009.        </script>
010.    </telerik:RadCodeBlock>
011.</asp:Content>
012.<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
013.       <div class="centeredContent">
014.        <div class="centeredTable">
015.            <table align="center" width="900">
016.                <tr>
017.                    <td>
018.                        <p align="center" class="mediumHeader">
019.                            <asp:Label ID="adminLookupLabel"
020.                                runat="server"
021.                                Text='<%$ Resources:Resource, AdminLookUpTitle %>'
022.                                CssClass="mediumHeader" />
023.                        </p>
024.                    </td>
025.                </tr>
026.                <tr>
027.                    <td>
028.                        <asp:Label ID="errorMessageLabel" runat="server" CssClass="ErrorLabelTable" Text="" Visible="false" />
029.                    </td>
030.                </tr>
031.            </table>
032. 
033.            <table align="center" width="900">
034.                <tr>
035.                    <td>
036.                        <div style="width: 900px; height: auto">
037. 
038.                            <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
039.                                <AjaxSettings>
040.                                    <telerik:AjaxSetting AjaxControlID="AdminLookUpGrid">
041.                                        <UpdatedControls>
042.                                            <telerik:AjaxUpdatedControl ControlID="AdminLookUpGrid" />
043.                                        </UpdatedControls>
044.                                    </telerik:AjaxSetting>
045.                                </AjaxSettings>
046.                            </telerik:RadAjaxManager>
047.                            <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
048. 
049.                            <telerik:RadGrid ID="AdminLookUpGrid" runat="server"
050.                                AllowPaging="True" Skin="Windows7"
051.                                AllowAutomaticUpdates="True"
052.                                AutoGenerateColumns="False"
053.                                CellSpacing="0"
054.                                Height="300px"
055.                                GridLines="None"
056.                                OnNeedDataSource="LoadData" OnUpdateCommand="UpdateData"
057.                                AllowMultiRowSelection="True" Width="900px">
058.                                <ClientSettings>
059.                                    <Selecting AllowRowSelect="True" />
060.                                </ClientSettings>
061.                                <MasterTableView DataKeyNames="ID, User_ID, First_Name, Last_Name, Employee_Number, Role_Function, Is_Active"
062.                                                 ShowHeadersWhenNoRecords="True">
063.                                    <Columns>
064.                                        <telerik:GridBoundColumn DataField="ID" Visible="false">    
065.                                        </telerik:GridBoundColumn>
066.                                        <telerik:GridBoundColumn DataField="User_ID"
067.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_UserID %>'
068.                                            UniqueName="User_ID">
069.                                            <HeaderStyle Width="250px" />
070.                                        </telerik:GridBoundColumn>
071.                                        <telerik:GridBoundColumn DataField="First_Name"
072.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_FirstName %>'
073.                                            UniqueName="First_Name">
074.                                            <HeaderStyle Width="100px" />
075.                                        </telerik:GridBoundColumn>
076.                                        <telerik:GridBoundColumn DataField="Last_Name"
077.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_LastName %>'
078.                                            UniqueName="Last_Name">
079.                                            <HeaderStyle Width="100px" />
080.                                        </telerik:GridBoundColumn>
081.                                        <telerik:GridBoundColumn DataField="Employee_Number"
082.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_EmployeeNumber %>'
083.                                            UniqueName="Employee_Number">
084.                                            <HeaderStyle Width="100px" />
085.                                        </telerik:GridBoundColumn>
086.                                        <telerik:GridBoundColumn DataField="Role_Function"
087.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_RoleFunction %>'
088.                                            UniqueName="Role_Function">
089.                                            <HeaderStyle Width="100px" />
090.                                        </telerik:GridBoundColumn>
091.                                        <telerik:GridBoundColumn DataField="Is_Active"
092.                                            HeaderText='<%$ Resources:Resource, AdminLookUp_IsActive %>'
093.                                            UniqueName="Is_Active">
094.                                            <HeaderStyle Width="100px" />
095.                                        </telerik:GridBoundColumn>
096.                                    </Columns>
097.                                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
098.                                </MasterTableView>
099.                                <PagerStyle PageSizeControlType="None"></PagerStyle>
100.                                <FilterMenu EnableImageSprites="False"></FilterMenu>
101.                            </telerik:RadGrid>
102. 
103. 
104.                        </div>
105.                    </td>
106.                </tr>
107.                <tr>
108.                     
109.                    <td align="right">
110.                        <asp:Button ID="saveButton" runat="server" Text="Save" />
111.                        <asp:Button ID="cancelButton" runat="server" Text="Cancel" />
112.                        <asp:Button ID="goBackButton" runat="server" Text="GoBack" OnClick="goBackButton_Click" />
113.                    </td>
114.                </tr>
115.            </table>
116.        </div>
117.   </div>
118.</asp:Content>

Sasha
Top achievements
Rank 1
 answered on 15 Sep 2014
1 answer
269 views
I am attempting to use the Rad Editor for my website and I do NOT want JavaScript to be working, or any type of XSS capabilities.

This is what my declaration looks lik
<telerik:RadEditor ID="txtContent" Height="500" Width="600" runat="server" ToolsFile="~/DesktopModules/Admin/RadEditorProvider/Toolsfile/ToolsFileWithUpload.xml"
                SpellCheckSettings-AllowAddCustom="false" SpellCheckSettings-AjaxUrl="/Telerik.Web.UI.SpellCheckHandler.axd" OnClientLoad="OnClientLoad"
                NewLineMode="P" DialogsCssFile="~/css/TelerikSkin/TelerikSkin.css" AllowScripts="false" ContentFilters="RemoveScripts">
                <Content>
                </Content>
                <CssFiles>
                    <telerik:EditorCssFile Value="~/css/YellowToken.css" />
                </CssFiles>
                <SpellCheckSettings AllowAddCustom="False" AjaxUrl="/Telerik.Web.UI.SpellCheckHandler.axd"></SpellCheckSettings>
</telerik:RadEditor>

As you can see: AllowScripts="false" and ContentFilters="RemoveScripts" are both set.
Unfortunately I can still enter in something like:
<script>alert('This Is Bad');</script>
And it will still do the alert. Every time.

I was then searching around on the telerik site looking for help and ran across the OnClientLoad method of removing items.
function OnClientLoad(editor, args) {
                    editor.get_filtersManager().add(new MyFilter());
                }
                MyFilter = function () {
                    MyFilter.initializeBase(this);
                    this.set_isDom(false);
                    this.set_enabled(true);
                    this.set_name("RadEditor filter");
                    this.set_description("RadEditor filter description");
                }
                MyFilter.prototype =
                {
                    getHtmlContent: function (content) {
                        var dom = document.createElement("DIV");
                        dom.innerHTML = content;
                        var elems = dom.getElementsByTagName("*");
 
                        for (var i = 0; i < elems.length; i++) {
 
                            //Remove all onmouseover, onmouseout, onclick eventhandlers from element
                            var elem = elems[i];
                            if (elem.hasAttribute("onmouseover")) {
                                elem.setAttribute("onmouseover", "");
                            }
                            if (elem.hasAttribute("onerror")) {
                                elem.setAttribute("onerror", "");
                            }
                            if (elem.hasAttribute("onclick")) {
                                elem.setAttribute("onclick", "");
                            }
                            if (elem.hasAttribute("alert")) {
                                elem.setAttribute("alert", "");
                            }
                        }
                        return dom.innerHTML;
                    },
                    getDesignContent: function (content) {
                        var dom = document.createElement("DIV");
                        dom.innerHTML = content;
                        var elems = dom.getElementsByTagName("*");
 
                        for (var i = 0; i < elems.length; i++) {
 
                            //Remove all onmouseover, onmouseout, onclick eventhandlers from element
                            var elem = elems[i];
                            if (elem.hasAttribute("onmouseover")) {
                                elem.setAttribute("onmouseover", "");
                            }
                            if (elem.hasAttribute("onerror")) {
                                elem.setAttribute("onerror", "");
                            }
                            if (elem.hasAttribute("onclick")) {
                                elem.setAttribute("onclick", "");
                            }
                            if (elem.hasAttribute("alert")) {
                                elem.setAttribute("alert", "");
                            }
                        }
                        return dom.innerHTML;
 
                    }
                }
 
                MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);

I attempted this from a forum post a while back. Unfortunately it doesn't actually fix the issue either. It doesn't remove any of the things that it says it does.

And this is where I am stuck at. Nothing is really working for what it says its doing and I am leaving this for next week. I am just hoping someone points out something that I am perhaps doing wrong and can fix, or I don't know what.
Alexander
Top achievements
Rank 1
 answered on 15 Sep 2014
1 answer
108 views
Hi

I have FileExplorer in FormView and when changing from ReadOnly To Edit Mode it seems to loose the configuration that i do in
Page_Load().

Thank you for your help.

Vessy
Telerik team
 answered on 15 Sep 2014
1 answer
85 views
I am working on a page that uses the lightbox, and I noticed that the left/right buttons only show up when the mouse if hovered on them. Our web page will be used by mobile devices and other systems with touch-screens which do not have the ability to hover. Is there a way to make the left/right buttons always visible?
Galin
Telerik team
 answered on 15 Sep 2014
1 answer
118 views
I've written an application that uses RadMap to display GeoJson shape data for the individual counties in a selected State in the USA. 
In ANY other browser (Chrome, Safari, FireFox) the RadMap is displayed perfectly.  In IE (Any version) the radmap navigation is displayed but the map is completely empty.   I'm at my wits end trying to troubleshoot this and would appreciate any help anyone can give me. 
I've included the aspx relating to the radmap as well as the associated js file text. 
 
<telerik:RadMap runat="server" ID="RadMap1" Zoom="6" Width="100%" Height="500" Skin="MetroTouch" >
<CenterSettings Latitude="40" Longitude="-100" />
<LayerDefaultsSettings>
<ShapeSettings>
    <StyleSettings>
 <FillSettings Color="DarkBlue " Opacity="1" />
<StrokeSettings Color="White" />
</StyleSettings>
</ShapeSettings>
</LayerDefaultsSettings>
<ClientEvents OnShapeCreated="shapeCreated" OnShapeMouseEnter="shapeMouseEnter"
OnShapeClick="shapeClick" OnShapeMouseLeave="shapeMouseLeave" OnClick="clientClick" />
<LayersCollection>
<telerik:MapLayer ClientDataSourceID="RadClientDataSource1" Type="Shape" Opacity="1">
</telerik:MapLayer>
                </LayersCollection>

</telerik:RadMap>

---- Script.js ----
var HIGHLIGHT_STROKE_COLOR = "Red";
var HIGHLIGHT_STROKE_HOVER_COLOR = "Green";
var COUNTRIES_COLOR = "DarkBlue";
var COUNTRIES_STROKE_COLOR = "White";

function shapeCreated(e) {

if (e.shape.dataItem.properties["GEO_ID"].substring(0, 2) === '05') {
if (e.shape.dataItem.properties["STATE"] === getParameterByName("ID")) {

var COUNTY_NAME = e.shape.dataItem.properties["NAME"];
var COUNTIES_COLOR = getcountycolor(e.shape.dataItem.properties["NAME"]);

e.shape.options.set("fill.color", COUNTIES_COLOR);
e.shape.options.set("stroke.color", COUNTRIES_STROKE_COLOR);
e.shape.innerHTML = e.shape.dataItem.properties["NAME"];

}
else { e.shape.options.set("visible", false); }
}


}

function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
function shapeMouseEnter(e) {
document.getElementById("lblShapeName").innerHTML = e.shape.dataItem.properties["NAME"];
e.shape.options.set("fill.color", HIGHLIGHT_STROKE_COLOR);
e.shape.options.set("stroke.color", HILIGHT_STROKE_COLOR);

e.shape.toolTip.set(e.shape.dataItem.properties["NAME"]);


}

function shapeMouseLeave(e) {

e.shape.options.set("fill.color",COUNTRIES_COLOR);
e.shape.options.set("stroke.color", COUNTRIES_STROKE_COLOR);
}

function shapeClick(e) {

if (e.shape.dataItem.properties["GEO_ID"].substring(0,2) === '05')
{
var County = e.shape.dataItem.properties['NAME'];
var state = getParameterByName("state");
window.location = "http://olaagenthub.onelifeamerica.com/OrderLeadsCounties.aspx?County=" + County + "&state="+state+"&ID=" + e.shape.dataItem.properties['STATE'];
}
else{
var state = e.shape.dataItem.properties['NAME'];
window.location = "http://olaagenthub.onelifeamerica.com/OrderLeadsCounties.aspx?state="+state+"&ID="+e.shape.dataItem.properties['STATE'];
}


}



function markerCreated(e) {
e.preventDefault();
}

function clientClick(e) {
toolTip.hide();
}

function clientPan(e) {
toolTip.hide();
}

function zoomStart(e) {
toolTip.hide();
}



function buildToolTipFromShape(shape, div) {

div.innerHTML = "<div><span class='detail'>Name: </span><span>" + shape.dataitem.properties["NAME"] + "</span></div>"

}

function getColorFromMagnitude(magnitude) {
return interpolateColor(magnitude, 3, 7, 255, 255, 0, 240, 0, 0);
}

function interpolateColor(value, minimum, maximum, R1, G1, B1, R2, G2, B2) {
value = value > maximum ? maximum : value;
value = value < minimum ? minimum : value;
value = value - minimum;
var percent = value / (maximum - minimum);

var r1 = R1 / 255.0, g1 = G1 / 255.0, b1 = B1 / 255.0;
var r2 = R2 / 255.0, g2 = G2 / 255.0, b2 = B2 / 255.0;

var r3 = (r1 + (r2 - r1) * percent) * 255;
var g3 = (g1 + (g2 - g1) * percent) * 255;
var b3 = (b1 + (b2 - b1) * percent) * 255;
return rgb2hex(r3, g3, b3);
}

function rgb2hex(red, green, blue) {
var rgb = blue | (green << 8) | (red << 16);
return '#' + (0x1000000 + rgb).toString(16).slice(1)
}
Vessy
Telerik team
 answered on 15 Sep 2014
5 answers
209 views
I would like to see some extra intelligence in the various Telerik drop-down controls, so that they avoid opening the drop-downs beyond the edges of the browser canvas.  Ideally, the behavior would be similar to the way drop-down boxes avoid crossing the edges of the screen in native windows applications.

In my case, I have RadToolBarSplitButton controls in multiple locations on the page, including close to the bottom of the page, and close to the right-hand edge of the page.  I am using the default ExpandDirection of Down.  This is a problem for the controls near the bottom of the page, because some of the drop-down items are rendered below the bottom edge of the browser window.  I am using EnableDefaultButton = false, and the text for some of the items is longer than the text on the RadToolBarSplitButton.  This is a problem for the controls near the right-hand edge of the page, because some of the drop-down is rendered beyond the right-hand edge of the browser window.  In both cases, the browser scroll bars extend to provide access to the rendered content beyond the previous edges of the canvas, but as soon as you click in the scroll bar to see the rest of the drop-down, the drop-down loses focus and collapses.

I am currently using the following javascript as a work-around, making use of the RadToolBar OnClientDropDownOpening and OnClientDropDownOpened events.
var canvasWidth, canvasHeight; 
       
function OnClientDropDownOpening(sender, args) { 
// We need to obtain the canvas width and height before the drop-down causes the canvas to expand. 
    canvasWidth = document.documentElement.scrollWidth; 
    canvasHeight = document.documentElement.scrollHeight; 
 
function OnClientDropDownOpened(sender, args) { 
    var button = args.get_item(); 
    var buttonElem = button.get_element(); 
    var dropDownContainer = button.get_dropDownElement().offsetParent; 
 
    var offsetRight = dropDownContainer.offsetLeft + dropDownContainer.offsetWidth; 
    if (canvasWidth < offsetRight) 
        dropDownContainer.style.left = (dropDownContainer.offsetLeft - offsetRight + canvasWidth) + "px"
 
    if (canvasHeight < dropDownContainer.offsetTop + dropDownContainer.offsetHeight) 
        dropDownContainer.style.top = (dropDownContainer.offsetTop - dropDownContainer.offsetHeight - buttonElem.offsetHeight) + "px"

The expand and collapse animations still think the drop-down is expanding down rather than up, so I have disabled the animations.  If you attempt to use the undocumented set_expandDirection client method to adjust the animation, you will notice that there is an infinite recursion bug in this method in RadToolBarScripts.js.
set_expandDirection:function(){if(this.set_expandDirection()==value){return
That's obviously meant to be get_expandDirection() in the if statement.

I am using RadControls for ASP.NET AJAX Q1 2010, with an assembly version of 2010.1.309.35.
Boyan Dimitrov
Telerik team
 answered on 15 Sep 2014
3 answers
145 views


IE 11 for windows was recently released for windows 7, while checking our site for problems we are seeing the same issues as this example. The vertical panel tabs have been shortened, chopping off text



http://demos.telerik.com/aspnet-ajax/splitter/examples/sp_firstlook/defaultcs.aspx



Vessy
Telerik team
 answered on 15 Sep 2014
2 answers
116 views
Our pivot grid is using OLAP settings bound to a data-cube.  I need to grab a handle on the SelectedIndexChanged event in the filter window's SetOptions; "Includes/Excludes".

I have tried the traditional mechanisms to wire the event during the FilterBox's Pre_Render event:

filterWindow.SetOptions.SelectedIndexChanged += SetOptions_SelectedIndexChanged;  

However, I can not get the event to fire.  Could I get some help?
Angel Petrov
Telerik team
 answered on 15 Sep 2014
4 answers
189 views
I have a usercontrol, categoryTree, for which I want to save it's state (namely whether checkboxes in a RadTreeView are checked) across sessions. So I have added this to the main page:

<telerik:RadPersistenceManager ID="RadPersistenceManager1" runat="server">
    </telerik:RadPersistenceManager>

And this to categoryTree.aspx:

​<telerik:RadPersistenceManagerProxy ID="RadPersistenceManagerProxy1" runat="server">
    <PersistenceSettings>
        <telerik:PersistenceSetting ControlID="RadTreeView1" />
    </PersistenceSettings>
</telerik:RadPersistenceManagerProxy>

And this to the codebehind:

private RadPersistenceManager _persistenceManager;

protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            _persistenceManager = RadPersistenceManager.GetCurrent(Page);
            if (!IsPostBack)
                _persistenceManager.LoadState();
        }


(and in the event for checked nodes):

_persistenceManager.SaveState();

But after I restart the page, the previous state does not get loaded. What am I missing?
C
Top achievements
Rank 1
 answered on 15 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?