Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
181 views
I'm running a script on window.onbeforeunload to check to see if the form is 'dirty'

this works for asp controls:

$('select').bind('change', function (event) { dataChanged = 1 })
$('input').bind('input', function (event) { dataChanged = 1 })

but I can't find an equivalent for a radComboBox or radDatePicker.
Anybody running this check?

Thanks
Bill
Top achievements
Rank 1
 answered on 20 Mar 2015
1 answer
122 views
Hi

I have Telerik Grid with Textbox when i enter the textbox i need calculated in my Telerik Grid Footer Template so how will do this
i tried row.findcontrol("controlname") but i canot get footer value and setvalue also any one guide me.
Eyup
Telerik team
 answered on 20 Mar 2015
3 answers
1.0K+ views
I am new to Telerik and pretty new to C# as well. Wanting to build a website that uses the RadPageLayout so it can be responsive.

I thought I would find a sample app that does part of what I need to do, like user login, remember me, user logout, user forgot password, registration, change password, and then build from there. It doesn't look like any of the sample apps do this sort of thing.

Does anyone know of a sample application that I could use to learn Telerik and help with my application that I would like to create? If it used the RadPageLayout as the base, that would be fantastic.

Thanks in advance



Hristo Valyavicharski
Telerik team
 answered on 20 Mar 2015
0 answers
164 views
Hi, Support

i have a dynamically added repeater to asp Panel control (see the code below)

DataRepeater.ID = String.Format("DR{0}", ItemID);
DataRepeater.DataSource = oToDoList;
DataRepeater.DataBind();
 
foreach (RepeaterItem RItem in DataRepeater.Items)
{ ... }
 
pnlNiches.Controls.Add(DataRepeater);

This is working good, repeater is added to asp Panel. But, when I try to retrieve repeater items, it appears that panel doesn't contain any control.

Repeater DataRepeater = (Repeater)pnlNiches.FindControl(String.Format("DR{0}", ItemID));
if (DataRepeater != null)
{
    foreach (RepeaterItem RItem in DataRepeater.Items)
    { ... }
}

I am sure that I don't clear panel controls in the code.
What can be the reason of this strange behavior? Thanks in advance!

















Bobi
Top achievements
Rank 1
 asked on 20 Mar 2015
4 answers
541 views
I am using radgrid filter in which i am performing search operation,when i put text it filters the data but when i put text along with special characters for eg: building[ then filter does not work.


Milena
Telerik team
 answered on 20 Mar 2015
3 answers
68 views
I need to setup progress area for lengthy logic that located in dll outside the page.

Not sure how to approach this.

Please help
Hristo Valyavicharski
Telerik team
 answered on 20 Mar 2015
1 answer
94 views
I need to setup progress bar for lengthy logic that located in dll outside the page.
Not sure how to approach this.
Please help
Hristo Valyavicharski
Telerik team
 answered on 20 Mar 2015
5 answers
387 views
using 2014.3.1024.45. I am using a RadGrid with checklist filtering, nothing special. Wen two options from the listbox are checked, the radgrid doesn't filter properly, also when two or more columns are filtered at the same time. here's my markup
<telerik:RadGrid ID="grdProjects" runat="server" AllowFilteringByColumn="True" AllowSorting="True" AutoGenerateColumns="False" OnItemCreated="grdProjects_ItemCreated" FilterType="CheckList"
        GroupPanelPosition="Top" ShowGroupPanel="True" OnNeedDataSource="grdProjects_NeedDataSource" AllowPaging="True" ShowFooter="True" CellSpacing="-1" GridLines="None" OnFilterCheckListItemsRequested="grdProjects_FilterCheckListItemsRequested">
        <ClientSettings AllowDragToGroup="True" ClientEvents-OnRowClick="openProject">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <ItemStyle CssClass="popup-trigger" />
        <AlternatingItemStyle CssClass="popup-trigger" />
        <MasterTableView DataKeyNames="ProjectID,IsLead" ClientDataKeyNames="ProjectID,IsLead">
            <Columns>
                <telerik:GridBoundColumn Visible="false" DataField="ProjectID">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Title"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" FilterControlWidth="250" HeaderText="Title" UniqueName="Title" DataType="System.String" Aggregate="Count" FooterText="Total Projects:">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text="" />
                    </ColumnValidationSettings>
                    <ItemStyle Width="45%" />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn FilterControlAltText="Filter ResponsibleOfficerID column"  FilterCheckListEnableLoadOnDemand ="true"  HeaderText="Responsible Officer" UniqueName="ResponsibleOfficerID" DataField="NAME" SortExpression="Name">
                    <ItemTemplate>
                        <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width: 40px;">
                                    <img src="<%# Eval("SThumbPath") %>" width="38px" /></td>
                                <td nowrap="nowrap"><%# Eval("NAME") %></td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
 <telerik:GridBoundColumn HeaderText="Template" UniqueName="TemplateName" DataField="TemplateName" FilterCheckListEnableLoadOnDemand="true" FilterListOptions="VaryByDataType">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn HeaderText="Current Stage" UniqueName="CurrentStage" DataField="CurrentStage" FilterCheckListEnableLoadOnDemand="true" >
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="Status" DataType="System.String" SortExpression="Status"  FilterCheckListEnableLoadOnDemand="true">
                    <ColumnValidationSettings>
                        <ModelErrorMessage Text=""></ModelErrorMessage>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
 
    </telerik:RadGrid>


and my code behind

protected void grdProjects_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
       {
           string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
           var ds = ProjectModel.GetAllProjects();
           switch (DataField)
           {
               case "ProjectID":
                   e.ListBox.DataSource = ds.Select(p => p.ITCProjectID).OrderBy(p => p).Distinct().ToList();
                   break;
               case "Title":
                   e.ListBox.DataSource = ds.Select(p => p.Title).OrderBy(p => p).Distinct().ToList();
                   break;
               case "NAME":
                   e.ListBox.DataSource = ds.Select(p => p.NAME).OrderBy(p => p).Distinct().ToList();
                   break;
               case "TemplateName":
                   var list = ds.Select(p => p.TemplateName).Distinct().ToList();
                   list.Add("Project Lead");
                   list = list.OrderBy(l => { return l; }).ToList();
                   e.ListBox.DataSource = list;
                   break;
           }

can anyone help please. I have been cracking my head with this for 2 hours now with no luck. thanks
Viktor Tachev
Telerik team
 answered on 20 Mar 2015
1 answer
391 views
I am attempting to create a TreeView with Tri-State Checkboxes. However, I want tri-state checkboxes right down to bottom level of the tree, not just to represent mixed selection of attributes on a parent node. Every node must have the ability to be tri-state. This doesn't seem possible using the built in checkbox capability of the TreeView, so what I've done is use a TreeView Template and embed a RadButton Type=ToggleType with tri-state functionality. As Such:

<telerik:RadTreeView runat="server" ID="RadTreeView1">
        <NodeTemplate>
            <telerik:RadTreeNode Text="<%# DataBinder.Eval(Container.DataItem, "Name") %>">
            <NodeTemplate>
            <telerik:RadButton OnClientCheckedChanged="GetSiblings" ID="RadButton1" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton" AutoPostBack="false" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'>
                <ToggleStates>
                    <telerik:RadButtonToggleState Value="Unchecked" PrimaryIconCssClass="rbToggleCheckbox"></telerik:RadButtonToggleState>
                    <telerik:RadButtonToggleState Value="Default" PrimaryIconCssClass="rbToggleCheckboxFilled"></telerik:RadButtonToggleState>
                    <telerik:RadButtonToggleState Value="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" Selected="true">    </telerik:RadButtonToggleState>
                </ToggleStates>
            </telerik:RadButton>
            </NodeTemplate>
            </telerik:RadTreeNode>
        </NodeTemplate>
    </telerik:RadTreeView>
<telerik:RadButton ID="Button1" runat="server" OnClick="Button1_Click" Text="Traverse the Tree"></telerik:RadButton>
<div class="module">
   <h2>You have selected the following items:</h2>
   <asp:Label ID="nodesClientside" runat="server" BorderStyle="None" CssClass="text"></asp:Label>
</div>

This has worked just fine so far for the functionality I need. Where I am running into a problem, is trying to manage changing parent checkboxes to match when all children or no children are selected. Obviously if a node has three children and it is selected then I want all the children to match the selected state. Likewise, if any one child node is selected I would like to get all sibling nodes, check if they are all the same state and set the parent node state appropriately.

However, Client Side when the OnClientCheckedChanged event fires for the RadButton within the Node, how do I pass the javascript a reference to the RadTreeNode that the RadButton is contained within? Or even on the backend if i call OnCheckedChanged from the RadButton embedded inside a RadTreeNode, is there a way I can get a reference to that node so that I can use get_parent.get_nodes() or traverse the TreeView to retrieve all sibling nodes for processing? 

I've pasted the complete code files below

Thanks.


Complete Front end ascx file code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeView.ascx.cs" Inherits="DDW.TreeView" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <title>Telerik ASP.NET Example</title>
    <style type="text/css">
        .node-album
        {
            width: 186px;
            height: 35px;
            background: transparent url('images/album.png');
        }
 
        .node-album .band,
        .node-album .album
        {
            margin-left: 37px;
            display:block;
        }
 
        .node-album .band
        {
            font-size: 14px;
        }
        .node-album .album
        {
            color:#871fdf;
            font-size: 11px;
            line-height: 13px;
        }
        .node-album-data 
        {
            width:420px;
        }
        .node-album-data img
        {
            float:left;
            margin-top: 5px;
        }
        .node-album-data .album
        {
            font-size: 18px;
        }
        .node-album-data .album,
        .node-album-data .details
        {
            display:block;
            margin-left: 90px;
        }
 
        .node-album-data .details
        {
            margin-top: 10px;
            white-space:normal;
        }
        .RadTreeView_Default .rtHover span.rtIn
        {
            color: black !important;
            background:none !important;
            border: none !important;
            padding: 2px !important;
        }

        .RadTreeView_Default .rtSelected span.rtIn
        {
            color: black !important;
            background:none !important;
            border: none !important;
            padding: 2px !important;
        }
        .rtToggleCheckboxMixed {
            background: #CCC;
        }
    </style>
    <script type="text/javascript">
        function GetSiblings(textName) {
            var tree = $find("<%= RadTreeView1.ClientID %>");
            var node = tree.findNodeByText(textName);
            var allSiblingNotes = node.get_parent.get_nodes();
            for (var i = 0; i < allSiblingNotes.length; i++) {
                var node = allSiblingNotes[i];
                var CheckBox = node.findControl("RadButton1");
                alert(CheckBox.get_text());
            }
        }
    </script>
</head>
<body>
    <div class="demo-container size-medium">
            <telerik:RadTreeView runat="server" ID="RadTreeView1">
                <NodeTemplate>
                    <telerik:RadTreeNode Text="<%# DataBinder.Eval(Container.DataItem, "Name") %>">
                    <NodeTemplate>
                    <telerik:RadButton OnClientCheckedChanged="GetSiblings" ID="RadButton1" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton" AutoPostBack="false" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'>
                        <ToggleStates>
                            <telerik:RadButtonToggleState Value="Unchecked" PrimaryIconCssClass="rbToggleCheckbox"></telerik:RadButtonToggleState>
                            <telerik:RadButtonToggleState Value="Default" PrimaryIconCssClass="rbToggleCheckboxFilled"></telerik:RadButtonToggleState>
                            <telerik:RadButtonToggleState Value="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" Selected="true"></telerik:RadButtonToggleState>
                        </ToggleStates>
                    </telerik:RadButton>
                    </NodeTemplate>
                    </telerik:RadTreeNode>
                </NodeTemplate>
            </telerik:RadTreeView>
        <telerik:RadButton ID="Button1" runat="server" OnClick="Button1_Click" Text="Traverse the Tree"></telerik:RadButton>
        <div class="module">
           <h2>You have selected the following items:</h2>
           <asp:Label ID="nodesClientside" runat="server" BorderStyle="None" CssClass="text"></asp:Label>
        </div>

    </div>
</body>
</html>


Backend Code Complete:
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;


namespace DDW
{
    public partial class TreeView : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RadTreeView1.DataSource = GetAttributes();

                RadTreeView1.DataFieldID = "ID";
                RadTreeView1.DataFieldParentID = "ParentID";
                //attributesTree.DataTextField = "Name";

                RadTreeView1.DataBind();

            }
        }

        public List<Attribute> GetAttributes()
        {
            List<Attribute> attributesList = new List<Attribute>();

            attributesList.Add(new Attribute(1, null, "Attribute A", "Description for Attribute A", true, false, false));
            attributesList.Add(new Attribute(2, 1, "Attribute A1", "Description for Attribute A1", true, false, false));
            attributesList.Add(new Attribute(3, 1, "Attribute A2", "Description for Attribute A2", false, false, false));
            attributesList.Add(new Attribute(4, 1, "Attribute A3", "Description for Attribute A3", false, false, false));
            attributesList.Add(new Attribute(11, 4, "Attribute A3a", "Description for Attribute A3a", false, false, false));
            attributesList.Add(new Attribute(12, 4, "Attribute A3b", "Description for Attribute A3b", false, false, false));
            attributesList.Add(new Attribute(5, null, "Attribute B", "Description for Attribute B", true, false, true));
            attributesList.Add(new Attribute(6, 5, "Attribute B1", "Description for Attribute B1", true, false, true));
            attributesList.Add(new Attribute(7, 5, "Attribute B2", "Description for Attribute B2", false, false, false));
            attributesList.Add(new Attribute(8, null, "Attribute C", "Description for Attribute C", false, false, false));
            attributesList.Add(new Attribute(9, 8, "Attribute C1", "Description for Attribute C1", false, false, false));
            attributesList.Add(new Attribute(10, 8, "Attribute C2", "Description for Attribute C2", false, false, false));


            return attributesList;

        }
        public class Attribute
        {
            public int ID { get; set; }
            public int? ParentID { get; set; }
            public string Name { get; set; }
            public string Description { get; set; }
            public bool Include { get; set; }
            public bool Exclude { get; set; }
            public bool Default { get; set; }

            public Attribute()
            {

            }

            public Attribute(int id, int? parentID, string name, string description, bool def, bool include, bool exclude)
            {
                ID = id;
                ParentID = parentID;
                Name = name;
                Description = description;
                Default = def;
                Include = include;
                Exclude = exclude;
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            ShowCheckedNodes(RadTreeView1, nodesClientside);
        }
        private static void ShowCheckedNodes(RadTreeView treeView, Label label)
        {
            string message = string.Empty;
            foreach (RadTreeNode node in treeView.GetAllNodes())
            {
                RadButton CheckBoxState = (RadButton)node.FindControl("RadButton1");
                message += CheckBoxState.Text + ": " + CheckBoxState.ToggleStates[CheckBoxState.SelectedToggleStateIndex].Value + "<br/>";

            }
            label.Text = message;
        }
    }
}











Dimitar
Telerik team
 answered on 20 Mar 2015
2 answers
64 views
Hi,

I've been trying to link to RadTimePicker together, so when i change the time of one of them the time is adjust properly. I only have a problem and i don't know if its possible to do something about it.

When i change the time to of the first time picker, the result is the time selected should be on the next day.

eg. I select 23h30 on today and the result i want is 00h00 on the next day.

I does change the time on the second RadTimePicker, but it always stays as today.

My question is, is there a way to change the date to the RadTimePicker? I know that there's a RadDateTimePicker but i can't use this control on the page i have right now.

Thx for your help,

Guillaume
Guillaume
Top achievements
Rank 1
 answered on 20 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?