Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
211 views
Hi All,

I try to make unlimited hierarchical radgrid with SelfHierarchySettings. But when i try to expand a node i can not see the child level inside "No child records to display."  I don't want to use  HierarchyLoadMode ="Client"  so can any body check and inform me what's the problem with my code

Regards ..

<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="sm" runat="server" /> 
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnColumnCreated="RadGrid1_ColumnCreated" 
        OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound" 
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind">  
        <MasterTableView AllowSorting="true" DataKeyNames="FullPath,ParentPath,IsFolder" 
            Width="100%" > 
            <SelfHierarchySettings ParentKeyName="FullPath" KeyName="ParentPath" /> 
        </MasterTableView> 
        <ClientSettings AllowExpandCollapse="true" /> 
    </telerik:RadGrid> 
    </form> 
</body> 

 

public partial class test2 : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            GridBoundColumn col = new GridBoundColumn();  
            col.HeaderText = "FullPath";  
            col.DataField = "FullPath";  
            RadGrid1.Columns.Add(col);  
 
            col = new GridBoundColumn();  
            col.HeaderText = "ParentPath";  
            col.DataField = "ParentPath";  
            RadGrid1.Columns.Add(col);  
            RadGrid1.DataSource = GetData("/");  
 
        }  
    }  
 
    private DataTable GetData(string ParentPath)  
    {  
        DataTable dt = new DataTable();  
        dt.Columns.Add(new DataColumn("FullPath"));  
        dt.Columns.Add(new DataColumn("ParentPath"));  
        dt.Columns.Add(new DataColumn("IsFolder"typeof(bool)));  
        DataRow dr;  
        for (int i = 0; i < 3; i++)  
        {  
            dr = dt.NewRow();  
            dr[0] = ParentPath + "Folder" + i;  
            dr[1] = ParentPath;  
            dr[2] = true;  
            dt.Rows.Add(dr);  
        }  
 
        for (int i = 0; i < 2; i++)  
        {  
            dr = dt.NewRow();  
            dr[0] = ParentPath + "File" + i.ToString() + ".txt";  
            dr[1] = ParentPath;  
            dr[2] = false;  
            dt.Rows.Add(dr);  
        }  
 
        return dt;  
    }  
 
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
    {  
        if (e.Column is GridExpandColumn)  
        {  
            e.Column.Visible = false;  
        }  
        else if (e.Column is GridBoundColumn)  
        {  
            e.Column.HeaderStyle.Width = Unit.Pixel(100);  
        }  
    }  
 
    public void Page_PreRenderComplete(object sender, EventArgs e)  
    {  
        HideExpandColumnRecursive(RadGrid1.MasterTableView);  
    }  
 
    public void HideExpandColumnRecursive(GridTableView tableView)  
    {  
        GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);  
        foreach (GridNestedViewItem nestedViewItem in nestedViewItems)  
        {  
            foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)  
            {  
                nestedView.Style["border"] = "0";  
 
                Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton");  
                if (nestedView.ParentItem.GetDataKeyValue("IsFolder").ToString() == "False")  
                {  
                    if (MyExpandCollapseButton != null)  
                    {  
                        MyExpandCollapseButton.Style["visibility"] = "hidden";  
                    }  
                    nestedViewItem.Visible = false;  
                }  
                else 
                {  
                    if (MyExpandCollapseButton != null)  
                    {  
                        MyExpandCollapseButton.Style.Remove("visibility");  
                    }  
                }  
 
                if (nestedView.HasDetailTables)  
                {  
                    HideExpandColumnRecursive(nestedView);  
                }  
            }  
        }  
    }  
 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        CreateExpandCollapseButton(e.Item, "FullPath");  
 
        if (e.Item is GridHeaderItem && e.Item.OwnerTableView != RadGrid1.MasterTableView)  
        {  
            e.Item.Style["display"] = "none";  
        }  
 
        if (e.Item is GridNestedViewItem)  
        {  
            e.Item.Cells[0].Visible = false;  
        }  
    }  
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        CreateExpandCollapseButton(e.Item, "FullPath");  
    }  
 
    public void CreateExpandCollapseButton(GridItem item, string columnUniqueName)  
    {  
        if (item is GridDataItem)  
        {  
            if (item.FindControl("MyExpandCollapseButton") == null)  
            {  
                Button button = new Button();  
                button.Click += new EventHandler(button_Click);  
                button.CommandName = "ExpandCollapse";  
                button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand";  
                button.ID = "MyExpandCollapseButton";  
 
                if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)  
                {  
                    string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID);  
 
                    button.OnClientClick = script;  
                }  
 
                int level = item.ItemIndexHierarchical.Split(':').Length;  
 
                if (level > 1)  
                    button.Style["margin-left"] = level + 10 + "px";  
 
 
                TableCell cell = ((GridDataItem)item)[columnUniqueName];  
                cell.Controls.Add(button);  
                cell.Controls.Add(new LiteralControl("&nbsp;"));  
                cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString()));  
            }  
        }  
    }  
 
    void button_Click(object sender, EventArgs e)  
    {  
        ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand";  
    }  
 
    protected void RadGrid1_DetailTableDataBind(Object source, GridDetailTableDataBindEventArgs e)  
    {  
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;  
        if (dataItem.GetDataKeyValue("IsFolder").ToString() == "True")  
        {  
            e.DetailTableView.DataSource = GetData(dataItem.GetDataKeyValue("FullPath").ToString());  
        }  
    }  
}  
 
Pavlina
Telerik team
 answered on 16 Apr 2014
2 answers
677 views
Hi,
I am using raddropdowntree. If i select any item in rad drop down tree, event is not firing. when i click on dropdowntree item and out side of the page then "ddtModule_EntryAdded" this event is firing. Is there any another event for dropdowntree when user select an item. Please suggest me a best way ASAP.

Regards,
Ranga.prasad
John
Top achievements
Rank 1
 answered on 16 Apr 2014
3 answers
123 views
I have an RadAutoCompleteBox in the EditForm. What I need to do is to populate another textbox in the Editform based on the value selected in the RadAutoCompleteBox once the value has been selected. I cannot find the right approach to do this. 
Any help / advice is greatly appreciated.

Fim
Top achievements
Rank 1
 answered on 16 Apr 2014
1 answer
134 views
I have an OrgChart  with 2 rendered fields. Am trying to remove the rendered fields for the Root node. i tried to access the node's rendered fields  in the nodeDataBound event, but its not working:

example:

  if (e.Node.ID == "Parent")
            {
                for (int i = e.Node.GroupItems[0].RenderedFields.Count - 1; i >= 0; i--)
                {
                    e.Node.GroupItems[0].RenderedFields[i] = new OrgChartRenderedField();
                }
            }

Thanks
Mira
Boyan Dimitrov
Telerik team
 answered on 16 Apr 2014
3 answers
186 views
I have an OrgChart  with 2 rendered fields. Am trying to remove the rendered fields for the Root node. i tried to access the node's rendered fields  in the nodeDataBound event, but its not working:

example:

  if (e.Node.ID == "Parent")
            {
                for (int i = e.Node.GroupItems[0].RenderedFields.Count - 1; i >= 0; i--)
                {
                    e.Node.GroupItems[0].RenderedFields[i] = new OrgChartRenderedField();
                }
            }

Thanks
Mira
Boyan Dimitrov
Telerik team
 answered on 16 Apr 2014
1 answer
93 views
Hi,
    Currently I am facing an issue with longtouch event for Grid. I attached a contextmenu for the grid.

<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="250px" />
when I press longtouch
. When there is scrollheight and then the grid has many records and it has scroll bar, then the ContextMenu appears and disappear in IPAD.
. When there are few records and no scroll bar then the Contextmenu stay when it open.

I have attached a gif file showing the problem.

Thanking you
Lakpa Sherpa
Galin
Telerik team
 answered on 16 Apr 2014
1 answer
148 views
Hello:
I am using the batch edit demo here as my starting point https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx
I noticed it uses allowautomaticinserts/updates/deletes

Before purchasing radgrid, I was used to writing my stored procedures to accept only my required parameters, not every single one.
is there a way to get batch editing to work with code behind, calling a command (updateAll) and passing my parameters manually?
Angel Petrov
Telerik team
 answered on 16 Apr 2014
1 answer
91 views
Hi there,

i am using stacked bar charts for my project. 

the issue i am facing is i have my each bar displaying number of males and females in that particular group.

now i want that bar clickable which will take me to members of the group i clicked bar for. and for that i need my x axis value so that i can pass it in where condition for my subquery. but i am unable to find my x axis value. can you please guide me through on how to accomplish the task.
Danail Vasilev
Telerik team
 answered on 16 Apr 2014
2 answers
172 views
Is there a way for me to drag and nodes from the file explorer to a radgrid?  I would then handle the event and add a new item to the radgrid based on the current dropped object.
Vessy
Telerik team
 answered on 16 Apr 2014
1 answer
226 views
Hello Telerik Team,

We have Event Management kind of asp.net web application and we have used the Telerik toolkit in our application. The current Telerik version currently we
are using is 2012.2.912.35. We have used RadComboBox in our application extensively and most of the places we have set MarkFirstMatch property of RadComboBox to TRUE.

Previously when we access our application in IE9 browser then RadcomboxBox filtering feature was working very smoothly but later
on we started using IE 10 and IE 11 browsers then we noticed that the text at the top of RadComboBox diappears.

In following screenshot you can see the country RadComboBox. I am using IE 10 or IE11 browser and suppose I search for “Boise”.
Now when I started typing the alphabets in RadComboBox, the text at the top of DDL disappear and an X appears toward the center of the DDL.
Please refer following screenshot:
NOTE: The same problem is appearing for all of the RadComboboxes which are present in all of the pages of our application.

[Refer ss1.png]

In above screenshot, we can see that RadComboBox filters the results correctly but the text at top of DDL disappears and X appears at center
which doesn’t looks well.

This is the code of our web page where the country RadComboBox is located.  

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" EnableScriptCombine="false">
            <Scripts>
            </Scripts>
        </telerik:RadScriptManager>
        <br />
        <br />
        <telerik:RadComboBox ID="cbCities" runat="server" Width="200px" MarkFirstMatch="true" ExpandDirection="Down">
            <Items>
                <telerik:RadComboBoxItem Text="Atlanta" Value="1" />
                <telerik:RadComboBoxItem Text="Austin" Value="2" />
                <telerik:RadComboBoxItem Text="Baltimore" Value="3" />
                <telerik:RadComboBoxItem Text="Boise" Value="4" />
                <telerik:RadComboBoxItem Text="Boston" Value="5" />
            </Items>
        </telerik:RadComboBox>
    </form>   
</body>
</html>
 

During investigation we found that when the “Display intranet sites in Compatibility View” option of IE11 is unchecked then dropdown works as
desired and if we checked this option for IE11 then again the top of the text of DDL got disappears during typing a text.

[Refer ss2.png]

We cannot unchecked the
“Display intranet sites in Compatibility View” of IE because when we unchecked this option in IE browser then complete design of our web pages
got messed up.

I have also tried adding the script given in below link but this didn’t resolved the issue at our end.
http://www.telerik.com/forums/patch-ms-update-kb2586448-breaks-radcombobox-markfirstmatch-in-versions-older-than-2009-3-1314-inclusive


Please suggest any generic workaround so that the filtering feature of all RadComboBox present in our application works as desired in IE11 and IE 10 browsers.

Thanks,
Riz

Nencho
Telerik team
 answered on 16 Apr 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?