Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
177 views
Hi Telerik

I'm trying to get at node i a treeview to behave as normal, but the user must not be able to change the nodes checked state.
Is it posible to make a node "ReadOnly" but behave as normal?

I've made a small test project to show that i'm looking for.

Hope you understand my problem.

The Html
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadTreeView.Default" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<!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>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="True" 
            TriStateCheckBoxes="True" DataFieldID="id" DataFieldParentID="Parrentid" 
            onnodedatabound="RadTreeView1_NodeDataBound" CheckChildNodes="true">
              
        </telerik:RadTreeView>
    </div>
    </form>
</body>
</html>


Code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace RadTreeView
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RadTreeView1.CheckBoxes = true;
            RadTreeView1.DataSource = TreeDataItem.GetTreeData();
            RadTreeView1.DataBind();
        }
  
        protected void RadTreeView1_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
        {
            TreeDataItem _node = e.Node.DataItem as TreeDataItem;
  
            e.Node.Text = _node.Text;
            //e.Node.Checkable = !_node.ReadOnly;
            e.Node.Checked = _node.Selected;
  
            if (_node.ReadOnly)
            {
                e.Node.ImageUrl = "CheckedCheckbox.jpg";
                e.Node.Checked = true;
                e.Node.Enabled = false;
                e.Node.Attributes.Add("style", "Color: #000000;");
            }
        }
    }
}

Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
  
namespace RadTreeView
{
    public class TreeDataItem
    {
        private string _text;
  
        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }
  
        private int _id;
  
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }
  
        private int _parrentId;
  
        public int ParrentId
        {
            get { return _parrentId; }
            set { _parrentId = value; }
        }
  
        private bool _readOnly;
  
        public bool ReadOnly
        {
            get { return _readOnly; }
            set { _readOnly = value; }
        }
  
        private bool _selected;
  
        public bool Selected
        {
            get { return _selected; }
            set { _selected = value; }
        }
  
  
        public TreeDataItem (int id, int parrentId, string text, bool Readonly, bool selected)
        {
            _id = id;
            _parrentId = parrentId;
            _text = text;
            _readOnly = Readonly;
            _selected = selected;
        }
  
        public static List<TreeDataItem> GetTreeData()
        {
            List<TreeDataItem> data = new List<TreeDataItem>();
  
            data.Add(new TreeDataItem(1, 0, "Beer", false, false));
            data.Add(new TreeDataItem(2, 1, "Carlsberg", false, true));
            data.Add(new TreeDataItem(3, 1, "Heineken", false, false));
            data.Add(new TreeDataItem(4, 0, "Food", false, false));
            data.Add(new TreeDataItem(5, 4, "Burger", false, true));
            data.Add(new TreeDataItem(6, 4, "Pizza", false, false));
            data.Add(new TreeDataItem(7, 4, "Sandwitch", true, true));
            data.Add(new TreeDataItem(8, 4, "Spagetti", false, false));
            return data;
        }
    }
}
Jakob
Top achievements
Rank 1
 answered on 30 Mar 2011
9 answers
167 views
I have an application with master page, I placed rad-scheduler under RadAjaxPanel on my content page with ScriptManager/RadScriptManager. When I insert any appointment it works fine but when i update any appointment it does not work, it fails to update.
Similarly when I do the same work in my simple ASPX page without any master page it works fine for me.
In both case i use SQLDataSource wizard to select,insert,update and delete from RadScheduler.

Please help me out I am stuck.
Urgent response is appreciated 

Regards,
Mohsin
Veronica
Telerik team
 answered on 30 Mar 2011
1 answer
58 views
Hi all!
Hope this is the right section of the forum for my question.
I'm trying to build a custom skin using the Visual Style Builder. It's the first time I use custom skins so forgive me if that's a dumb question but I'm going nutty.
The problem is that when viewed in Firefox everything works almost fine (I still have to change something that can't be changed using this awesome tool so I have to edit the default sprite), instead everything gets screwed up when viewed in IE8. You can find attached herewith two screenshots: one showing the skin rendered in IE 8, the other showing the screen rendered in Firefox 4.
I can't find out why.

Thanks in advance,
Daniele Salatti

Dimo
Telerik team
 answered on 30 Mar 2011
1 answer
209 views
Hi,
I'm searching the web for several days but couldn't find a solution yet.
What I want to do is to use the RADGrid with User Control Edit Form for insert and update. And I want to use SQLDatasource to reduce the code for insert/update operations. Displaying the data from the grids selected item in the user control works fine. But I have problems to insert and update records using the SQLDatasource with parameters. Seems that the insert/update events are not fired.

Is it possible to use SQLDataSource for update/insert when using a user control in RADGrid? Are there any samples for that available?

Thanks for your help.

Uwe
Princy
Top achievements
Rank 2
 answered on 30 Mar 2011
3 answers
558 views
ok I have RadGrid implemented, it works great and I can see my data
I implemented a checkbox control on that grid

<telerik:GridTemplateColumn HeaderText="Select"  UniqueName="AssetId">
    <ItemTemplate>
        <asp:CheckBox ID="CheckBox1" runat="server" />
    </ItemTemplate>
</telerik:GridTemplateColumn>


Now I have a button on the page, under its click event I want to read all the rows which are checked
I am doing something similar but its not working.
I am unable to check the checkbox is checked or not.

   protected void UpdateButton_Click(object sender, EventArgs e)
    {
    for (int i = 0; i < RadGrid1.MasterTableView.Items.Count; i++)
            {
                bool isChecked = ((CheckBox)RadGrid1.MasterTableView.FindControl("CheckBox1")).Checked;
 
                if (isChecked)
                {
                    Label lbl = ((Label)RadGrid1.FindControl("lblRadItemId")) as Label;
                    LabelValue = ((Label)RadGrid1.Rows[i].Cells[8].FindControl("lblRadItemId")).Text;
                }
 
}




Shinu
Top achievements
Rank 2
 answered on 30 Mar 2011
3 answers
61 views
dear all,
    I bind my radgrid with Need DataSource in code behind. I want to edit my radgrid when double click the grid row , I want one of the page appear with rowid. can? help me please.?
kham
Top achievements
Rank 1
 answered on 30 Mar 2011
2 answers
130 views
Hi;
I have a table that it is structured as self Referencing with ID and Parent ID. Can RADTreeView display this structure? If yes, any sample to see?

Thanks!
..Ben
Ben Hayat
Top achievements
Rank 2
 answered on 30 Mar 2011
3 answers
158 views
Hello,

For a ComboBox like this:

<telerik:RadComboBox ID="Persons" runat="server" DataTextField="Name" DataValueField="Id" MarkFirstMatch="true" AppendDataBoundItems="true">
    <Items>
        <telerik:RadComboBoxItem runat="server" Value="0" Text="" />
    </Items>
</telerik:RadComboBox>

When I select an item then click somewhere else, the combobox seems to reset or clear the selection. This is happening with various comboboxes on my page.

How can I get the selected item to stay where it should? There is no postback or anything. This happens on the client side and the control binds with data with no issue.

Richard
Richard Weeks
Top achievements
Rank 2
 answered on 29 Mar 2011
1 answer
159 views
I have a telerik radgrid with paging enabled and attaching the oncommand client event messes up paging.
Without the oncommand event, I am able to click on page numbers on the pager and it properly shows the selected page number text in bold.
But if I attach a oncommand event, it does not highlight the selected page number at all. And all the page numbers remain as hyperlinks including the selected page. Here is the sample code to reproduce this issue. Can some one please let me know if there is a fix ? I need to be able to trap the commands and cancel them if possible before postback happens to the server. And pagination is very critical for me as well. I tried to attach the oncommand event handler in the server side code(on page load event) but it doesnt help.

<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
  <script type="text/javascript">
      function onInqGridCmd(sender, eventArgs) {
      }
   </script>
</telerik:RadCodeBlock>   
 
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" EnableEmbeddedSkins="true" Skin="Gray" AllowSorting="True"
    AllowPaging="True" PageSize="5" runat="server" GridLines="None" Width="100%">
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <ClientSettings>
        <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true"   />
        <ClientEvents  OnCommand="onInqGridCmd"></ClientEvents>
    </ClientSettings>
     
</telerik:RadGrid>
 
<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM              Customers" runat="server"></asp:SqlDataSource>

Appreciate your help.
Daniel
Telerik team
 answered on 29 Mar 2011
4 answers
201 views
Hi all,

I have a custom command created like so:

DockCommand settingsCommand = new DockCommand();
settingsCommand.Name = "Local Settings";
settingsCommand.Text = "Local Settings";
settingsCommand.CssClass = "LocalSettings";
settingsCommand.AutoPostBack = false;
settingsCommand.OnClientCommand = "ShowLocalSettings";
Commands.Add(settingsCommand);

function ShowLocalSettings(sender, eventArgs) {
    radDock = sender;
    var oWindow = window.radopen(null, "LocalSettingsWindow");
    oWindow.center();
}


The RadWindow appears fine and everything works as expected, but, in the background I can see my page refreshing when I click the custom command button -- even though autopostback is set to false. My RadWindow doesn't flash, and it's modal so the background can't be interacted with, but it is still distracting to see it refreshing once when my RadWindow is already displayed.

Any ideas on why this would be happening?

Sean
Top achievements
Rank 2
 answered on 29 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?