Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
606 views
Hi,

    I have to disable rad datepicker if a checkbox is checked. if i uncheck the checkbox i have to enable the rad datepicker.. I am able to disable the date picker in all browsers. But i am not able to enable the same in firefox, chrome and safai.. it works in IE.  Is there any solution to avoid this?

var CheckBoxNoExpiration = document.getElementById('<%= CheckBoxNoExpiration.ClientID %>');
                   var DatePicker = $find('<%= RadExpiryDate.ClientID %>');
                   var MandatoryMark = document.getElementById('<%= MandatoryMark.ClientID %>');
                   if (CheckBoxNoExpiration != null) {
                       if (CheckBoxNoExpiration.checked) {
                           if (MandatoryMark != null)
                               MandatoryMark.style.display = 'none';
                           DatePicker.get_dateInput().disable();
                           DatePicker.get_dateInput.onclick = function() { return false; };
                           //onKeyDown = "javascript:return false;"
                           DatePicker._popupButton.disabled = true;
                           DatePicker._popupButton.onclick = function() { return false; };
                       }
                       else {
                           if (MandatoryMark != null)
                               MandatoryMark.style.display = 'inline';
                           DatePicker.get_dateInput().enable();
                           DatePicker._popupButton.disabled = false;
                           DatePicker._popupButton.onclick = function() { DatePicker.togglePopup(); return false; };
                       }
                   }

Thx
Esther
Maria Ilieva
Telerik team
 answered on 10 Nov 2011
1 answer
79 views
Hi,

I noticed a strange behavior: when I drop a node onto another node which has no children and is loaded on demand by a webserivce, I will have the dropped node twice.

This is what I do
- expand node A by clicking the expand icon
- node A expands and has no children (using LoadOnDemand - webservice)
- I drag node B over node A
- The change of the parent is saved in database using a webservice
- After saving, I move node B client-side in javascript from the old parent to the new parent (node A)
- node B is visible under his new parent node A
- when I collapse node A and expand it again (by using the expand icon), I see the new node twice (the first was my moving in javascript the duplicate is fetched by webservice)

If node A would has at least one child when it is expanded the first time, everything is fine.
This only occurs if the new parent node had no children before the drag&drop operation.

How can I prevent that behavior?

Edit: What currently works for me is to clear the current node's children on the OnClientNodePopulatingHandler:
function OnClientNodePopulatingHandler(sender, e) {
   e.get_node().get_nodes().clear();
}

Is there a better way to achieve this?
Plamen
Telerik team
 answered on 10 Nov 2011
2 answers
142 views
Hi

This is the markup for 2 Rad combo boxes with Checkboes enabled

<td><telerik:RadComboBox ID="ddlCustomer" Runat="server" Width="245px" EnableEmbeddedSkins="false" Skin="Activity" CheckBoxes="true" AutoPostBack="true"></telerik:RadComboBox></td>

<td><telerik:RadComboBox ID="ddlLocation" Runat="server" Width="185px" EnableEmbeddedSkins="false" Skin="Activity" CheckBoxes="true" AutoPostBack="true"></telerik:RadComboBox></td>


These checkboxes are passed back to be parameters a data class to populate a Rad Grid.
In the Radgrid I have a column

<telerik:GridTemplateColumn HeaderText="Arrival" SortExpression="LocationArrival" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="LocationArrival">

<ItemTemplate>

 

<asp:CheckBox ID="chkLocationArrival" runat="server" AutoPostBack="True" OnCheckedChanged="chkLocationArrival_CheckedChanged"/>              

</ItemTemplate>

</telerik:GridTemplateColumn>

If the Checkboxes = true is enabled the postbask fails and the chkLocationArrival_CheckedChanged never runs.

Whats going on

Andy

Dimitar Terziev
Telerik team
 answered on 10 Nov 2011
1 answer
158 views
I have implemented a solution for a project that utilizes a RadGrid, custom filter controls, custom filtering, custom sorting, and custom paging.  I am using LINQ2SQL for my datasource, and using the NeedDataSource event.  Everything is working perfectly, except for when I try to filter a column using
ltcs = ltcs.Where(l => Object.Equals(l.status, null));
The pager is showing the correct number of records, as I am setting that using the VirtualItemCount property of the radgrid, but when the page loads, it is giving me the "No records to display" message inside the grid.

Below is the .aspx page, the .aspx.cs code behind, and the code for the custom filter control.  I have been struggling for a while to figure this out, but can't for the life of me figure out why it wouldn't be working.

HELP ME PLEASE!!!

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="ListToCountList.aspx.cs" Inherits="ListToCountList" %>
 
<%@ Register TagPrefix="rad" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="HU" Namespace="HumanUse.CustomControls" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .wait, .wait *
        {
            cursor: wait !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <rad:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
        DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <rad:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </rad:AjaxSetting>
            <rad:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <rad:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </rad:AjaxSetting>
        </AjaxSettings>
    </rad:RadAjaxManager>
    <rad:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="430px"
        Width="924px" Transparency="0">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0;" />
    </rad:RadAjaxLoadingPanel>
    <rad:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ShowViewForm(id, rowIndex) {
                var grid = $find("<%= RadGrid1.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
 
                var manager = GetRadWindowManager();
                var window1 = manager.getWindowByName("ListToCountForm");
                window1.setUrl("ListToCountForm.aspx?ltcid=" + id);
                window1.show();
                return false;
            }
            function refreshGrid(arg, rebindOnly) {
                alert('Your changes have been saved successfully');
                if (!arg && !rebindOnly) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
                else if (rebindOnly) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindOnly");
                }
                else {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindOnly");
                }
            }
        </script>
    </rad:RadCodeBlock>
    <rad:RadGrid ID="RadGrid1" runat="server" PageSize="25" GridLines="None" AllowCustomPaging="true" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" EnableLinqExpressions="false" AutoGenerateColumns="False">
        <MasterTableView ClientDataKeyNames="assignment_id" AllowCustomPaging="true" AllowMultiColumnSorting="true" AllowCustomSorting="true" DataKeyNames="assignment_id" AutoGenerateColumns="False" AllowFilteringByColumn="True">
            <Columns>
                <rad:GridBoundColumn HeaderText="Segment" AllowFiltering="true" AllowSorting="true" DataField="segment_id" UniqueName="segment_id" DataType="System.Int32" SortExpression="segment_id" CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
                </rad:GridBoundColumn>
                <rad:GridBoundColumn HeaderText="Photo Date" DataField="photo_date" DataType="System.DateTime" DataFormatString="{0:d}" SortExpression="photo_date" UniqueName="date" CurrentFilterFunction="EqualTo" ShowFilterIcon="false">
                </rad:GridBoundColumn>
                <HU:DistinctLTCValueDropDownFilterColumn FilterControlWidth="60" HeaderText="Initials" AllowFiltering="true" DataField="initials" UniqueName="initials" SortExpression="initials" ShowFilterIcon="false">
                    <ItemTemplate>
                        <%#Eval("initials") %>
                    </ItemTemplate>
                </HU:DistinctLTCValueDropDownFilterColumn>
                <HU:DistinctLTCValueDropDownFilterColumn FilterControlWidth="60" HeaderText="Zone" AllowFiltering="true" DataField="zone" UniqueName="zone" SortExpression="zone" ShowFilterIcon="false">
                    <ItemTemplate>
                        <%#Eval("zone")%>
                    </ItemTemplate>
                </HU:DistinctLTCValueDropDownFilterColumn>
                <HU:DistinctLTCValueDropDownFilterColumn FilterControlWidth="140" HeaderText="Field Office" AllowFiltering="true" DataField="FieldOffice" UniqueName="FieldOffice" SortExpression="FieldOffice" ShowFilterIcon="false">
                    <ItemTemplate>
                        <%#Eval("FieldOffice")%>
                    </ItemTemplate>
                </HU:DistinctLTCValueDropDownFilterColumn>
                <HU:DistinctLTCValueDropDownFilterColumn FilterControlWidth="100" HeaderText="Status" AllowFiltering="true" DataField="status" UniqueName="status" SortExpression="status" ShowFilterIcon="false">
                    <ItemTemplate>
                        <%#Eval("status")%>
                    </ItemTemplate>
                </HU:DistinctLTCValueDropDownFilterColumn>
                <rad:GridBoundColumn HeaderText="Last User" DataField="last_updated_user" ItemStyle-VerticalAlign="Top"
                    DataType="System.String" SortExpression="last_updated_user" AllowFiltering="true"
                    AllowSorting="true" CurrentFilterFunction="EqualTo"
                    ShowFilterIcon="false">
                </rad:GridBoundColumn>
                <rad:GridBoundColumn HeaderText="Last Update" DataField="last_update_date" ItemStyle-VerticalAlign="Top"
                    DataFormatString="{0:MM/dd/yyyy}" UniqueName="last_update_date" SortExpression="last_update_date"
                    AllowSorting="true" CurrentFilterFunction="EqualTo"
                    ShowFilterIcon="false">
                </rad:GridBoundColumn>
                <HU:DistinctLTCValueDropDownFilterColumn FilterControlWidth="50" HeaderText="Boating" AllowFiltering="true" DataField="boating" UniqueName="boating" SortExpression="boating" ShowFilterIcon="false">
                    <ItemTemplate>
                        <%#Eval("boating")%>
                    </ItemTemplate>
                </HU:DistinctLTCValueDropDownFilterColumn>
                <rad:GridTemplateColumn ItemStyle-VerticalAlign="Top" UniqueName="TemplateEditColumn"
                    AllowFiltering="True" HeaderText="Edit" HeaderStyle-Wrap="false">
                    <ItemTemplate>
                        <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink>
                    </ItemTemplate>
                    <FilterTemplate>
                        <asp:Button runat="server" ID="btnFilter" Text="Filter" OnClick="btn_Click" />
                        <br />
                        <asp:Button runat="server" ID="btnClearFilter" Text="Clear" OnClick="btn_ClearClick" />
                    </FilterTemplate>
                </rad:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </rad:RadGrid>
    <rad:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista">
        <Windows>
            <rad:RadWindow Skin="Vista" ID="ListToCountForm" ClientIDMode="Static" RestrictionZoneID="main" ShowContentDuringLoad="false" runat="server"
                Title="List To Count Form" Width="400px" Height="600px" ReloadOnShow="true" Modal="true" />
        </Windows>
    </rad:RadWindowManager>
</asp:Content>
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 HumanUse;
using System.Configuration;
using System.Text.RegularExpressions;
 
public partial class ListToCountList : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.CheckSecurity(true);
        RadGrid1.GroupingSettings.CaseSensitive = false;
        RadGrid1.ItemDataBound += new Telerik.Web.UI.GridItemEventHandler(RadGrid1_ItemDataBound);
        RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
    }
 
    protected void btn_Click(object sender, EventArgs e)
    {
        RadGrid1.Rebind();
    }
 
    protected void btn_ClearClick(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.FilterExpression = "";
        foreach (GridColumn c in RadGrid1.MasterTableView.Columns)
        {
            c.CurrentFilterValue = "";
        }
        RadGrid1.Rebind();
    }
 
    void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        WCSAerialDataContext db = new WCSAerialDataContext(ConfigurationManager.ConnectionStrings["WCS_AerialConnectionString"].ConnectionString);
        IQueryable<vwLTC> ltcs = db.vwLTCs;
        if (ShouldApplySortFilterOrGroup())
        {
            if (RadGrid1.MasterTableView.FilterExpression != "")
            {
                foreach (String s in RadGrid1.MasterTableView.FilterExpression.Replace("AND", "~").Split('~'))
                {
                    string column = s.Substring(2, s.IndexOf("]", 2) - 2);
                    string value = "";
                    if (column != "segment_id")
                    {
                        value = RadGrid1.MasterTableView.FilterExpression.Substring(RadGrid1.MasterTableView.FilterExpression.IndexOf("'") + 1, RadGrid1.MasterTableView.FilterExpression.IndexOf("'", RadGrid1.MasterTableView.FilterExpression.IndexOf("'") + 1) - (RadGrid1.MasterTableView.FilterExpression.IndexOf("'") + 1));
                    }
                    else
                    {
                        value = RadGrid1.MasterTableView.FilterExpression.Substring(RadGrid1.MasterTableView.FilterExpression.IndexOf("=") + 2, (RadGrid1.MasterTableView.FilterExpression.IndexOf(")", RadGrid1.MasterTableView.FilterExpression.IndexOf("=") + 2) - (RadGrid1.MasterTableView.FilterExpression.IndexOf("=") + 2)));
                    }
                    if (value == "NULL")
                        value = null;
                    switch (column)
                    {
                        case "segment_id":
                            ltcs = ltcs.Where(l => l.segment_id == int.Parse(value));
                            break;
                        case "photo_date":
                            ltcs = ltcs.Where(l => l.photo_date == DateTime.Parse(value));
                            break;
                        case "initials":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.initials, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.initials == value);
                            }
                            break;
                        case "zone":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.zone, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.zone == value);
                            }
                            break;
                        case "FieldOffice":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.FieldOffice, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.FieldOffice == value);
                            }
                            break;
                        case "status":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.status, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.status == value);
                            }
                            break;
                        case "last_updated_user":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.last_updated_user, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.last_updated_user == value);
                            }
                            break;
                        case "last_update_date":
                            ltcs = ltcs.Where(l => l.last_update_date == DateTime.Parse(value));
                            break;
                        case "boating":
                            if (value == null)
                            {
                                ltcs = ltcs.Where(l => Object.Equals(l.boating, null));
                            }
                            else
                            {
                                value = value.Replace("%", "");
                                ltcs = ltcs.Where(l => l.boating == value);
                            }
                            break;
 
                    }
                }
            }
            if (RadGrid1.MasterTableView.SortExpressions.Count > 0)
            {
                foreach (GridSortExpression exp in RadGrid1.MasterTableView.SortExpressions)
                {
                    switch (exp.FieldName)
                    {
                        case "segment_id":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.segment_id);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.segment_id);
                            break;
                        case "photo_date":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.photo_date);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.photo_date);
                            break;
                        case "initials":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.initials);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.initials);
                            break;
                        case "zone":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.zone);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.zone);
                            break;
                        case "FieldOffice":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.FieldOffice);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.FieldOffice);
                            break;
                        case "status":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.status);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.status);
                            break;
                        case "last_updated_user":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.last_updated_user);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.last_updated_user);
                            break;
                        case "last_update_date":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.last_update_date);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.last_update_date);
                            break;
                        case "boating":
                            if (exp.SortOrder == GridSortOrder.Ascending)
                                ltcs = ltcs.OrderBy(l => l.boating);
                            else if (exp.SortOrder == GridSortOrder.Descending)
                                ltcs = ltcs.OrderByDescending(l => l.boating);
                            break;
 
                    }
                }
            }
        }
        RadGrid1.VirtualItemCount = ltcs.Count();
        RadGrid1.DataSource = ltcs.Skip(RadGrid1.CurrentPageIndex * RadGrid1.PageSize).Take(RadGrid1.PageSize);
    }
 
    public bool ShouldApplySortFilterOrGroup()
    {
        return RadGrid1.MasterTableView.FilterExpression != "" || RadGrid1.MasterTableView.SortExpressions.Count > 0;
    }
 
    void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            string next = string.Empty;
            string previous = string.Empty;
            string current = string.Empty;
            current = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["assignment_id"].ToString();
            HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
            editLink.Attributes["href"] = "#";
            editLink.Attributes["onclick"] = String.Format("return ShowViewForm('{0}','{1}');", current, e.Item.ItemIndex);
        }
    }
 
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
            RadGrid1.MasterTableView.SortExpressions.Clear();
            RadGrid1.MasterTableView.GroupByExpressions.Clear();
            RadGrid1.Rebind();
        }
        else if (e.Argument == "RebindAndNavigate")
        {
            RadGrid1.MasterTableView.SortExpressions.Clear();
            RadGrid1.MasterTableView.GroupByExpressions.Clear();
            RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;
            RadGrid1.Rebind();
        }
        else if (e.Argument == "RebindOnly")
        {
            RadGrid1.Rebind();
        }
    }
}
using Telerik.Web.UI;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System;
 
namespace HumanUse.CustomControls
{
    /// <summary>
    /// Summary description for DistinctValueDropDownFilterColumn
    /// </summary>
    public class DistinctLTCValueDropDownFilterColumn : GridTemplateColumn
    {
        public enum Orders { ASC, DESC }
        public Orders Order { get; set; }
        public bool OrderResults { get; set; }
 
        protected override void SetupFilterControls(TableCell cell)
        {
            RadComboBox rcBox = new RadComboBox();
            rcBox.ID = "DDL" + this.UniqueName;
            rcBox.AutoPostBack = this.AutoPostBackOnFilter;
            rcBox.Width = this.FilterControlWidth;
            rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged;
            WCSAerialDataContext db = new WCSAerialDataContext();
            string q = String.Format("SELECT DISTINCT {0} FROM vwLTC", DataField);
            if(OrderResults)
            {
                q += " ORDER BY " + DataField + " " + Order.ToString();
            }
            IEnumerable<String> values = db.ExecuteQuery<String>(q);
            rcBox.Items.Add(new RadComboBoxItem("No Filter", ""));
            foreach (string s in values)
            {
                if(String.IsNullOrWhiteSpace(s))
                    rcBox.Items.Add(new RadComboBoxItem("", "NULL"));
                else
                    rcBox.Items.Add(new RadComboBoxItem(s, s));
            }
            cell.Controls.Add(rcBox);
        }
 
        protected override void SetCurrentFilterValueToControl(TableCell cell)
        {
            if (!(this.CurrentFilterValue == ""))
            {
                ((RadComboBox)cell.Controls[0]).Items.FindItemByValue(this.CurrentFilterValue).Selected = true;
            }
        }
 
        protected override string GetCurrentFilterValueFromControl(TableCell cell)
        {
            string currentText = ((RadComboBox)cell.Controls[0]).SelectedItem.Text;
            string currentValue = ((RadComboBox)cell.Controls[0]).SelectedItem.Value;
            this.CurrentFilterFunction = (currentText != "No Filter") ? GridKnownFunction.EqualTo : GridKnownFunction.NoFilter;
            return currentValue;
        }
 
        private void rcBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
        }
    }
}
Marin
Telerik team
 answered on 10 Nov 2011
1 answer
177 views
I'm using a RadListBox to drag and drop some values into a RadEditor, when I used it inFirefox it inserts de value where i have the cursor, but in IE it inserts the Radlistbox value always in the beginnig of the RadEditor content, i'm using the function: editor.pasteHtml("..."); as you have in the sample of emoticons, but no works for me..

Here I write me code lines:
<telerik:RadListBox ID="RadListbox1" runat="server" EnableDragAndDrop="True"  OnClientDragStart="OnClientDragStart" OnClientDragging="OnClientDragging" OnClientDropping="OnClientDropping"
        Width="250px" Height="100px" SelectionMode="Single" AllowDelete="false" >
        <ButtonSettings ReorderButtons="Common"></ButtonSettings>
    </telerik:RadListBox>
 
    <telerik:RadEditor OnClientLoad="OnClientLoad" ID="RadEditor1" runat="server" SkinID="DefaultSetOfTools" Visible="true" EditModes="Design"
        Height="500px" Width="650px" StripFormattingOnPaste="All" ToolsFile="~/App_GlobalResources/ToolsFile.xml"
        SpellCheckSettings-AllowAddCustom="false" SpellCheckSettings-DictionaryLanguage="es-ES"
        SpellCheckSettings-DictionaryPath="~/App_Data/RadSpell/" ContentAreaCssFile="EditorContentAreaStyles.css"  >
        <ImageManager EnableImageEditor="false" ViewPaths="" MaxUploadFileSize="512000" >
        </ImageManager>
        <Modules>
            <telerik:EditorModule Name="RadEditorStatistics" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorDomInspector" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorNodeInspector" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorHtmlInspector" Visible="false" Enabled="true" />                   
        </Modules>               
   

<script type="text/javascript">
//<![CDATA[
 
     function OnClientLoad(editor) {
         var list = $find("<%= RadListbox1.ClientID %>");
         makeUnselectable(list.get_element());
     }

     function OnClientDragStart() {         
         setOverlayVisible(true);
     }

     function OnClientDropping(sender, args) {
         var editor = $find("<%=RadEditor1.ClientID%>");        
         var event = args.get_domEvent();        
         document.body.style.cursor = "default";

         var result = isMouseOverEditor(editor, event);
       
         if (result) {
             var span_value = args.get_sourceItem().get_text();

             if (span_value) {                                 
                 editor.setFocus();
                 editor.pasteHtml("{" + span_value + "}");
                 args.set_cancel(true);
             }
         }
         setOverlayVisible(false);
     }

     function OnClientDragging(sender, args) {
         var editor = editor = $find("<%=RadEditor1.ClientID%>");
         var event = args.get_domEvent();
         
         if (isMouseOverEditor(editor, event)) {
             document.body.style.cursor = "hand";
         }
         else {
             document.body.style.cursor = "no-drop";
         }
     }

     /* ================== Utility methods needed for the Drag/Drop ===============================*/
     
     function makeUnselectable(element) {         
         var nodes = element.getElementsByTagName("li");
         
         for (var index = 0; index < nodes.length; index++) {
             var elem = nodes[index];             
             elem.setAttribute("unselectable", "on");
         }
     }

     //Create and display an overlay to prevent the editor content area from capturing mouse events
     var shimId = null;
     function setOverlayVisible(toShow) {
         if (!shimId) {
             var div = document.createElement("DIV");
             document.body.appendChild(div);
             shimId = new Telerik.Web.UI.ModalExtender(div);
         }

         if (toShow) shimId.show();
         else shimId.hide();
     }
     
     //Check if the image is over the editor or not
     function isMouseOverEditor(editor, events) {
     
         var editorFrame = editor.get_contentAreaElement();
         var editorRect = $telerik.getBounds(editorFrame);

         var mouseX = events.clientX;
         var mouseY = events.clientY;         

         if (mouseX < (editorRect.x + editorRect.width) &&
             mouseX > editorRect.x &&
                mouseY < (editorRect.y + editorRect.height) &&
             mouseY > editorRect.y) {
             return true;
         }
         return false;
     }

</script>


And I want to know if I can have another icon when I drag one item to the RadEditor, not the forbidden icon.

Thanks,

Rumen
Telerik team
 answered on 10 Nov 2011
1 answer
179 views
I'm exporting a grid to a CSV file, and am having a problem with the Byte Order Mark that is being placed in the first 3 characters of the file.

The exported grid is being imported directly into another (rather old and not changeable) application and failing with the inclusion of the BOM.

I've read here: http://www.telerik.com/help/aspnet-ajax/grid-csv-export.html that when exporting to a CSV file that the BOM is created automatically but I cannot find a way to stop this happening.

Cheers
Cliff
Princy
Top achievements
Rank 2
 answered on 10 Nov 2011
3 answers
146 views
Guys, i have defined a griddropdowncolumn but for some reason it is not displaying the bound value. When it edit mode, i populate the dropdown with no issues. Here is my column definition in the front end:

<telerik:GridDropDownColumn ListTextField="LotDetail.LotNumber" ListValueField="LotDetail.LotNumber" DataType="System.String"
            FilterControlAltText="Lot Number" HeaderText="Lot Number"
            SortExpression="LotDetail.LotNumber" UniqueName="LotNo" ReadOnly="true">
        </telerik:GridDropDownColumn>

If anyone could shed any light on this it would be great. My Telerik.Web.UI.dll version is 2011.2.915.40.
Michael
Top achievements
Rank 1
 answered on 10 Nov 2011
1 answer
61 views
Hi,

We need an urgent requirement, I want to know,is possible to achieve by Rad HTML editor.

Following Requirement:
1. We load the custom XML tags to html editor from database (values from database in xml datatype.)
    like <store><cabs></cabs></store>
2. We need to give link for external stylesheet for that tags (store,cabs).
3. In html editor ,after load the xml content . we place cursor in any position,we want to know the hierarchical node (upto parent node) details like breadcrumb on bottom
 for e.g., <store><cabs>This is sample text</cabs></store>
 
             if we place the cursor in content ,display like 'store > cabs >'

4. Need to get the current cursor position.

Thank you,
Rumen
Telerik team
 answered on 10 Nov 2011
2 answers
221 views
I open a modal rad window using the code below and specify a callback function to display a confirmation message to make sure the user wants to close the window. Everything works fine if the window is opened to a specific size. However, if I open the window and then maximize it, when the user attempts to close the window, it seems that the the confirm message gets displayed "behind" the rad window. Since it is maximized, the user cannot see it. The window doesn't close and there is no indication to the user. I'm not sure why the massage appears "on top" of the rad window if it is opened to a particular size, but behind if it is maximzed, however is there a way to make sure the confirmaiton message is always on top of the active rad window, even if it is maximized?

function openWindow(someUrl, width, heigth, xPos, yPos) {
      
    var oWin =  window.radopen(someUrl, 'MyWindow');
    oWin.setActive(true);
     
    

      oWin.setSize(width, height);

    if (xPos != null && yPos != null) {
       oWin.moveTo(xPos, yPos);
   }
   else {
       oWin.center();
   } 
    oWin.maximize();
     oWin.add_beforeClose(onBeforeClose);
                         
}
         
function onBeforeClose(sender, arg) {
        function callbackFunction(arg) {
               if (arg) {
                   sender.remove_beforeClose(onBeforeClose);
                   sender.close();
                }
           }
           arg.set_cancel(true);
           radconfirm("Are you sure you want to close this window?", callbackFunction, 400, 150, null, "Close Window");
       }
 
Marin Bratanov
Telerik team
 answered on 10 Nov 2011
1 answer
206 views
Hi I'm having a bit of an issue with the RadWindow with FF 7.01... for some reason, there is a border around it..When I click on the title bar and move it, it disappears but the sec i release the window it reappears... This is not happening in Chrome15 , IE 9

I'm calling it using

<telerik:RadWindowManager ID="wndManager" runat="server" Skin="Outlook">
    <Windows>
        <telerik:RadWindow ID="wndSetUp" runat="server" BorderStyle="None" EnableShadow="True"
            Height="730px" KeepInScreenBounds="True" Modal="True" NavigateUrl="InitialSetUp.aspx"
            Overlay="True" ShowContentDuringLoad="False" Style="display: none;" Title=" First Time Setup"
            Visible="False" VisibleStatusbar="False" Width="900px" VisibleTitlebar="True"
            Behavior="Close, Move" Behaviors="Close, Move" Skin="Outlook">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
Marin Bratanov
Telerik team
 answered on 10 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?