Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
116 views
I want to use the TreeView control in a ComboBox but I want to dynamically populate the nodes in the tree rather than defining them statically in the web page.  Do you have an example of this?  My main problem is I don't understand how to access the tree control since it is in the itemTemplate of the ComboBox.
Veronica
Telerik team
 answered on 14 Apr 2010
1 answer
78 views
Hi!

I'm trying to write a context menu control,for the reason to add context menu item dynamically!I wrote a web form page to invoke the control radcontextmenu.but when i click the href,I get a error:"Microsoft JScript runtime error: Object doesn't support this property or method"
web form page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication1.WebForm4" %> 
 
<%@ Register TagPrefix="CM" TagName="contextmenu" Src="~/contextmenu.ascx" %> 
<%@ 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">  
    <title></title>  
</head> 
<body> 
      
    <form id="form1" runat="server">  
    <script type="text/javascript">  
    //<![CDATA[
    function popupMenu(item, e) {
        window.<%=contex1.ClientID%>.ShowContextMenu(item, e);
    }
    //]]> 
    </script> 
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" /> 
    <div> 
        <CM:contextmenu ID="contex1" runat="server" /> 
        <onclick="popupMenu(this, event)">Click here!</a> 
    </div> 
    </form> 
 
</body> 
</html> 
 
web control form(contextmenu.ascx)
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="contextmenu.ascx.cs" Inherits="WebApplication1.contextmenu" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<Telerik:RadContextMenu id="RadContextMenu1" 
                runat="server" > 
    <Items> 
        <Telerik:RadMenuItem Text="Trees" /> 
        <Telerik:RadMenuItem Text="Sunset" /> 
        <Telerik:RadMenuItem Text="Mountains" /> 
    </Items> 
</Telerik:RadContextMenu> 
web control form cs(contextmenu.ascx.cs)
using System;  
using System.Collections.Generic;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
namespace WebApplication1  
{  
    public partial class contextmenu : System.Web.UI.UserControl  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
 
        }  
        protected override void OnPreRender(EventArgs e)  
        {  
            if (!this.Page.IsClientScriptBlockRegistered(this.GetType().FullName))  
                this.Page.RegisterClientScriptBlock(this.GetType().FullName, string.Format("<script type=\"text/javascript\" src=\"{0}\"></script>"this.ResolveUrl("~/ContextMenu.js")));  
 
            if (!Page.IsClientScriptBlockRegistered(this.ClientID))  
                Page.RegisterStartupScript(this.ClientID, String.Format("<script language=javascript>window.{0} = new ContextMenu('{0}', {1});</script>"this.ClientID, this.RadContextMenu1.ClientID));  
            base.OnPreRender(e);  
        }  
    }  
contextmenu.js
function ContextMenu(name, contextMenu) {  
    this.Name = name;  
    this.ContextMenuHandle = contextMenu;  
 
    this.ShowContextMenu = function() {  
        this.ContextMenuHandle.show(arguments[1]); //(the JScript error ) 
    }  
Any idea about what is wrong?

Thanks.
Veronica
Telerik team
 answered on 14 Apr 2010
1 answer
127 views
Hi,

I have using the Telerik control Q22009.
I have set the column resizing property of radgrid so it allow to resize the column but in this case we have to drag the column egde to resize the column.

1)Can it possble to resize the column to the largest size of data on coulmn egde double click just like excel . 
i.e In excel when you double click on the column it will expand to the largest piece of data.

I want to resize the column on click insted of dragging the column.

Thanks

 


Iana Tsolova
Telerik team
 answered on 14 Apr 2010
5 answers
465 views
when you have itemtemplate and asp controls you can't coolapse the panel? why is that? if you can please let me know. thanks.
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="fullexpandeditem" OnClientItemClicked="collapseRoots">  
                        <Items> 
                            <telerik:RadPanelItem  Value="RadPanelBar_CompanyReport" Text="Company Report">  
                                <ItemTemplate> 
                                    <telerik:RadTextBox ID="txt_test" runat="server" /> 
                                    <asp:Button ID="btn_Submit" runat="server" Text="Submit" OnClick="btn_Submit_ButtonClick"/>  
                                </ItemTemplate> 
                             </telerik:RadPanelItem>                                                      
                            <telerik:RadPanelItem Text="Test2">  
                                <Items> 
                                    <telerik:RadPanelItem Text="test2" /> 
                                </Items> 
                            </telerik:RadPanelItem> 
                            <telerik:RadPanelItem Text="test3">  
                                <Items> 
                                    <telerik:RadPanelItem Text="test3" /> 
                                </Items> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelBar> 
Yana
Telerik team
 answered on 14 Apr 2010
1 answer
52 views

Hello,telerik.
Another question about self-hierarchy grid:
In self-hierarchy gird, Does expand-collapse indicator icon only show in datakey ID column?
Can I move the indicator to the other column (for example: LastName,or FirstName of live DEMO )?

Please me ,help me.all guys 

thanks any way 

Daniel
Telerik team
 answered on 14 Apr 2010
1 answer
116 views
Tried following article for radgrid localization, it's fine but some parts couldn't change. Screenshots are attached. Fields marked with are not replaced.

Code-behind localization using extension methods (via ResourceManager)

I have a problem without localization. Using page codes

ASPX Code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Liste.ascx.cs" Inherits="Kp_Kontrol_Eklenti_Liste" 
    Debug="true" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetDS" TypeName="W5PCore.Modul.EklentiBLL">  
    <SelectParameters> 
        <asp:Parameter Name="EklentiID" Type="Int16" /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"   
    DataSourceID="ObjectDataSource1" GridLines="None" PageSize="2" Skin="Hay">  
    <PagerStyle Mode="NextPrevNumericAndAdvanced"   
        PageSizeLabelText="Sayfa Boyutu:" /> 
<MasterTableView DataSourceID="ObjectDataSource1">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
</MasterTableView> 
    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">  
    </ClientSettings> 
</telerik:RadGrid> 
 
 

ASPX.CS Code
using System;  
 
public partial class Kp_Kontrol_Eklenti_Liste : System.Web.UI.UserControl  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
          
    }  
}  
 

Thanks
Pavlina
Telerik team
 answered on 14 Apr 2010
1 answer
105 views
Hi Telerik.

I would like to hear if you have support for Publisher Policy Assembly? We have upgraded our Telerik components a couple of times, and it would be a great way for us to minimize the upgrade process instead of updating the web.confing with assembly redirects.

Best regards

Klaus
Stanimir
Telerik team
 answered on 14 Apr 2010
1 answer
150 views

Hi,

I am using the self-referencing hierarchy and dynamically assigning datasource (via dataset). I followed the demo code to implement my grid. Depending the value of a dropdownlist on the page, the datasource for the radgrid is different so I set AutoGenerateColumns="True". The problem that I'm having is that when a different value is selected from the dropdown, the mastertableview binds fine and the new columns are rendered but the detail views in the grid still retains the columns from a previous binding which results in the detail views having blank rows and mis-aligned with the parent table.

Any help is greatly appreciated.

Here's my aspx definition,

<telerik:RadGrid  
                                                                            ID="grdVwDashBoard"   
                                                                            runat="server"   
                                                                            AutoGenerateColumns="True" 
                                                                            onitemdatabound="grdVwDashBoard_ItemDataBound"   
                                                                                OnColumnCreated="grdVwDashBoard_ColumnCreated"   
                                                                                OnItemCreated="grdVwDashBoard_ItemCreated" Width="750px" Skin="Vista"   
                                                                                EnableLinqExpressions="false" > 
                                                                                <ClientSettings AllowExpandCollapse="True">  
                                                                                    <Scrolling UseStaticHeaders="true" AllowScroll="true" FrozenColumnsCount="0" SaveScrollPosition="true" /> 
                                                                                </ClientSettings> 
                                                                                <MasterTableView HeaderStyle-CssClass="gridHeaders" EnableNoRecordsTemplate="true" CommandItemDisplay="None" ItemStyle-CssClass="gridrowstyle" ShowHeadersWhenNoRecords="false" HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" DataKeyNames="MetricID, ParentMetricID, metricname" FilterExpression="ParentMetricID is NULL" Width="100%">   
                                      <NoRecordsTemplate> 
                                      <span class="emptyDataStyle">Please select a dashboard from the menu above.</span>              
                                      </NoRecordsTemplate>     
                                      <SelfHierarchySettings MaximumDepth="5" KeyName="MetricID" ParentKeyName="ParentMetricID" /> 
                                      <CommandItemSettings ShowExportToCsvButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" ExportToCsvImageUrl="images/xlsx.gif" ExportToCsvText="Export to Excel" /> 
                                      <HeaderStyle CssClass="gridHeaders" Wrap="false" /> 
                                      <ItemStyle CssClass="gridrowstyle" /> 
                                                                                </MasterTableView> 
                                                                                <ExportSettings ExportOnlyData="true" OpenInNewWindow="true"></ExportSettings> 
                                                                            </telerik:RadGrid> 
 

 

 

 

And here's the code,
 

 

 protected void grdVwDashBoard_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)  
            {  
                // loop through all measures and find out if the measure is integer type  
                // if interger type then format the value  
                int totalMeasuresCount = (int)Session["totalMeasuresCount"];  
 
                try 
                {  
                    for (int i = 0; i < e.Item.Cells.Count; i++)  
                    {  
                        int cellNo = 2;  
                        cellNo = i + cellNo;  
 
                        int num;  
                        bool measureVal = int.TryParse(e.Item.Cells[cellNo].Text.ToString(), out num);  
 
                        if (measureVal == true)  
                        {  
                            e.Item.Cells[cellNo].Text = int.Parse(e.Item.Cells[cellNo].Text).ToString("n0");  
                        }  
                    }  
 
                }  
                catch 
                {  
                }  
            }  
 
            CreateExpandCollapseButton(e.Item, "metricname");  
        }  
 
        public void Page_PreRenderComplete(object sender, EventArgs e)  
        {  
            HideExpandColumnRecursive(grdVwDashBoard.MasterTableView);  
            //HideExpandColumnRecursive(grid.MasterTableView);  
        }  
 
        private 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.Items.Count == 0)  
                    {  
                        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 grdVwDashBoard_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
        {  
            //e.OwnerTableView.CommandItemDisplay = GridCommandItemDisplay.None;  
 
            if (e.Column is GridExpandColumn)  
            {  
                e.Column.Visible = false;  
            }  
            else if (e.Column is GridBoundColumn)  
            {  
                GridBoundColumn column = e.Column as GridBoundColumn;  
                if (NO_DISPLAY_FIELDS.Any(a => a == column.DataField))  
                {  
                    e.Column.Visible = false;  
                }  
                else if (column.DataField == "metricname")  
                {  
                    e.Column.HeaderText = "Metric Name";  
                    e.Column.HeaderStyle.Width = Unit.Pixel(200);  
                }  
                else 
                {  
                    e.Column.HeaderStyle.Width = Unit.Pixel(100);  
                }  
            }  
        }  
 
        protected void grdVwDashBoard_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            CreateExpandCollapseButton(e.Item, "metricname");  
 
            if (e.Item is GridHeaderItem && e.Item.OwnerTableView != grdVwDashBoard.MasterTableView)  
            {  
                //e.Item.Visible = false;  
                e.Item.Style["display"] = "none";  
            }  
 
            if (e.Item is GridNestedViewItem)  
            {  
                e.Item.Cells[0].Visible = false;  
            }  
        }  
 
        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";  
        } 

 

Veli
Telerik team
 answered on 14 Apr 2010
2 answers
122 views

Hi all,

I am wondering if anyone has any idea that writing a row header of compare list.
At the begining, i decided to make a listview to do this. 

              <LayoutTemplate> 
                <table id="Table1" runat="server" border="1"   
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">  
                    <tr> 
                        <td>Happy</td> 
                        <%-- Goes here? --%> 
                        <asp:PlaceHolder ID="EmployeesContainer" runat="server" /> 
                    </tr> 
                    <tr> 
                        <td>Money</td> 
                    </tr> 
                    <tr> 
                        <td>Good</td> 
                    </tr> 
                 </table> 
            </LayoutTemplate> 
 
 
            <ItemTemplate> 
                <td> 
                    <asp:Label ID="YSE" runat="server"   
                        Text='<%# Eval("YES") %>' /> 
                    <%-- How about "Money" and "Good" column? --%>                  
                </td> 
            </ItemTemplate> 
 

It is difficult to make a codeless listview but now I just want to achieve this with anyway.

 

As u can see the attachment, happy, money and good are columns. A, B, C... are data.
If this is impossible, then I will write a table for this. Thx!

louis chan
Top achievements
Rank 1
Iron
 answered on 14 Apr 2010
1 answer
173 views
Dear Support,

I find that the page that I am loading into my RadWindow doesn't apply the styles in the app_themes directory. 
All the css and skin files are not shown in the head tag for the IFRAME page, but rather there are three tags that look like the below tag.

<LINK class=Telerik_stylesheet rel=stylesheet type=text/css href="/MASTRR/WebResource.axd?d=v9c6FiMMBVCv_RS52za5rWMWEoR0I4urecGaHYdAaM66IofJWOuBO54LLe4t682T0&amp;t=633868167800000000">  
 
 

Is there a way to have the page within the IFRAME use the linked CSS that exists in the Parent Page?

Thanks for your anticipated help,
Josh
Georgi Tunev
Telerik team
 answered on 14 Apr 2010
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?