Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
145 views
I have a class that contains information about reports:

public

 

class ReportRequest

 

{

 

 public int ReportID { get; set; }

 

 

 public string ReportName { get; set; }

 

 

 public int Days { get; set; }

 

 

 public ReportRequest(int reportID, string reportName, int days)

 

 {

 

  this.ReportID = reportID;

 

 

  this.ReportName = reportName;

 

 

  this.Days = days;

 

 }

}

and I want to load a collection of these objects into a combo box like this:

List<ReportRequest> reports = new List<ReportRequest>();

 

reports.Add(

new ReportRequest(1, "Report 1", 10));

 

reports.Add(

new ReportRequest(2, "Report 2", 20));

 

reports.Add(

new ReportRequest(3, "Report 3", 30));

 

reports.Add(

new ReportRequest(4, "Report 4", 40));

 

RadComboBox1.DataValueField =

"ReportID";

 

RadComboBox1.DataTextField =

"ReportName";

 

RadComboBox1.DataSource = reports;

RadComboBox1.DataBind();

I only want the report name to show but when a user makes a selection I'd like to get the Days property as well. Its not truly a multi-column combo box as only 1 column will show to the user. I also can't seen to add anything other than a RadComboBoxItem to the Items collection of the combo box.

How can I accomplish this?

Thanks

Carl

sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 23 Jan 2010
2 answers
183 views
Hello,

I have faced a problem that occurs many times when I use Javascript to handle Telerik Controls in ASP.NET page.
For example if my ASP.NET page's Page_load method is trying to invoke Telerik component, let's say RadTabStrip using Javascript
code like $find("radTabStrip1.ClientID") will return null and the whole script fails.

So, when putting Javascript code with setTimeout it doen't. Code like below will usually work.

 function SelectTab(index) {
      function Set() {
       var radTabStrip1 = $find("<%=RadTabStrip1.ClientID %>");
       radTabStrip1.get_tabs().getTab(index).click();
      }
      setTimeout(Set, 1000);
     }

So, my question is that how ASP.NET page and  Telerik Components are actually loaded?
Are they running in separate parallel Threads or how? Can I do something else than putting Javascript code
into setTimeOut? setTimeOut sounds a little bit wierd.

I have faced this problem sometimes with pure ASP.NET/Telerik Applications but very often if ASP.NET/Telerik Application is running under SharePoint.

Br

Michael
Mike
Top achievements
Rank 1
 answered on 23 Jan 2010
2 answers
167 views
Hi all. I need some help to get a value from a RadGrid. I have a RadGrid that contains several linkbutton fields. I am currently able to get a row value of a cell when I click on one of these links no problem. The problem I am having is I need to click on a link and then get the cell value of another link in the same row. Has anyone had any experience with this?

Here is my grid. I need to click on the Delete row and get the value of the SalesID row.

<

 

telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AllowPaging="True"

 

 

 

runat="server" GridLines="None" Width="100%" Skin="Web20"

 

 

 

PageSize="20">

 

 

 

<PagerStyle Mode="Slider" />

 

 

 

<HeaderStyle HorizontalAlign="Left" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

<AlternatingItemStyle HorizontalAlign="Left" />

 

 

 

<MasterTableView CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False"

 

 

 

DataKeyNames="SalesID" DataSourceID="SqlDataSource1" PageSize="20">

 

 

 

<Columns>

 

 

 

<telerik:GridButtonColumn CommandName="SalesID" DataTextField="SalesID"

 

 

 

HeaderText="Sales ID" UniqueName="SalesID" CommandArgument="SalesID">

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridBoundColumn DataField="UserName" HeaderText="UserName"

 

 

 

SortExpression="UserName" UniqueName="UserName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name"

 

 

 

SortExpression="FirstName" UniqueName="FirstName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name"

 

 

 

SortExpression="LastName" UniqueName="LastName">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="HomePhone" HeaderText="Home Phone"

 

 

 

SortExpression="HomePhone" UniqueName="HomePhone">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="CellPhone" HeaderText="Cell Phone"

 

 

 

SortExpression="CellPhone" UniqueName="CellPhone">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridButtonColumn CommandName="Email" HeaderText="Email" Text="Mail"

 

 

 

UniqueName="Email">

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridButtonColumn CommandName="Notes" HeaderText="Notes" Text="Edit"

 

 

 

UniqueName="Notes">

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridButtonColumn CommandName="Delete" HeaderText="Del<br/>Acc"

 

 

 

Text="Del" UniqueName="Delete">

 

 

 

</telerik:GridButtonColumn>

 

 

 

</Columns>

 

 

 

<PagerStyle Mode="Slider" Position="TopAndBottom" />

 

 

 

<CommandItemTemplate>

 

 

 

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

 

 

 

</CommandItemTemplate>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

This is what I am doing in code behind. I am using the e.CommandName to display the values in 2 labels but I cannot get the value of the SalesID.
 

 

 

 

 

If e.CommandName = "Delete" Then

 

 

Dim myItem As GridDataItem = DirectCast(e.Item, GridDataItem)

 

 

Dim cell As TableCell = myItem("UserName")

 

 

Dim cellSID As TableCell = myItem("SalesID")

 

 

lblSalesID.Text = cell.Text

 

lblUserName.text = cellSID.Text

 

End If

 

 

 

 

 

 

 

 

Chom
Top achievements
Rank 1
 answered on 23 Jan 2010
1 answer
437 views
Hi,

I got my datepicker controls working locally on a Windows Vista  IIS7 development server. However, on deploying my site on the Live server, a Windows 2003(IIS 6.0) Server, I cannot get it to work. I tried following the instructions laid out here and even uploaded Telerik.Charting.dll after I got an error. 

Here are portions of my Web.config
   <compilation debug="true" strict="false" explicit="true"
      <assemblies> 
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> 
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
          <add assembly="Telerik.Charting, Version=2.0.3.0, Culture=neutral, PublicKeyToken=D14F3DCC8E3E8763"/> 
          <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> 
      </assemblies> 
    </compilation> 
---------------- 
    <httpModules> 
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
            <!-- *******  Register the RadUploadModule for IIS prior to v.7  ****** --> 
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" /> 
        </httpModules> 
------------------- 
    <location path="Telerik.RadUploadProgressHandler.ashx"
        <system.web> 
            <authorization> 
                <allow users="*"/> 
            </authorization > 
        </system.web> 
    </location> 
--------------------------- 
<handlers> 
        <remove name="WebServiceHandlerFactory-Integrated" /> 
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" /> 
          <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" /> 
          
      </handlers> 
Am I missing something?

Thanks in advance.
wavuti
Top achievements
Rank 1
 answered on 22 Jan 2010
1 answer
92 views
Hi,
I am trying to create a grid programatically using client side databinding and it works fine when using GridBoundColumns but nothing appears when I use GridTemplateColumns. I have followed all the instructions from telerik(http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html).

I have pasted my code below.
In the PopulateResultGridColumns method right now it is adding GridBoundColumns. If we comment the region "GridBoundColumns" and uncomment the region "GridTemplateColumns" which adds GridTemplateColumns instead, it doesn't work.

This is a simplified example, and we have complex templates from GridView to be replaced with telerik grid.

Please let me know if client side databinding does work with programmatic creation of template fields.

Thanks,
Tilak

Below is my aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridExample._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"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
        <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager> 
        <telerik:RadGrid ID="ResultsGrid" runat="server" GridLines="None" AllowFilteringByColumn="true" 
            AllowSorting="true" AllowPaging="true" PageSize="10" EnableViewState="true">  
            <ClientSettings> 
                <DataBinding SelectMethod="FindItemsAndCount" /> 
            </ClientSettings> 
            <MasterTableView Width="100%">  
            </MasterTableView> 
            <PagerStyle Mode="NextPrevAndNumeric" /> 
        </telerik:RadGrid> 
          
        <asp:PlaceHolder ID="phGrid" runat="server"></asp:PlaceHolder> 
    </div> 
    </form> 
</body> 
</html> 
 

This is my code behind:
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 System.Web.Services;  
using System.Data;  
 
namespace GridExample  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
            PopulateResultGridColumns(this.ResultsGrid);  
              
            //RadGrid grid = new RadGrid();  
            //grid.AllowPaging = true;  
            //grid.AutoGenerateColumns = false;  
            //grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;  
            //PopulateResultGridColumns(grid);  
            //grid.ClientSettings.DataBinding.SelectMethod = "FindItemsAndCount";  
            //grid.ClientSettings.DataBinding.Location = "Default.aspx";  
            //phGrid.Controls.Add(grid);  
            //grid.Rebind();  
        }  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            ResultsGrid.ClientSettings.DataBinding.Location = "Default.aspx";  
            ResultsGrid.Rebind();  
        }  
 
        protected void PopulateResultGridColumns(RadGrid grid)  
        {  
            List<Field> fields = new List<Field>  
            {  
                new Field { DisplayName = "ID", ColumnName = "ID" },  
                new Field { DisplayName = "Name", ColumnName = "Name" },  
                new Field { DisplayName = "Description", ColumnName = "Description" },  
                new Field { DisplayName = "Location", ColumnName = "Location" },  
                new Field { DisplayName = "Name", ColumnName = "Name" }  
 
            };  
            foreach (var field in fields)  
            {
                #region GridBoundColumns  
                GridBoundColumn col = new GridBoundColumn();  
                grid.MasterTableView.Columns.Add(col);  
                col.DataField = field.ColumnName;  
                col.HeaderText = field.DisplayName;  
                if (field.ColumnName == "ID")  
                    col.DataType = Type.GetType("System.Int32");
                #endregion  
 
                #region GridTemplateColumns  
                //GridTemplateColumn tfield = new GridTemplateColumn();  
                //grid.MasterTableView.Columns.Add(tfield);  
                //tfield.ItemTemplate = new BoundTemplate(System.Web.UI.WebControls.ListItemType.Item, field.ColumnName);  
                //tfield.DataField = field.ColumnName;  
                //tfield.HeaderText = field.DisplayName;  
                //if (field.ColumnName == "ID")  
                //    tfield.DataType = Type.GetType("System.Int32");  
                #endregion  
            }  
        }  
          
        [WebMethod(EnableSession = true)]  
        public static Dictionary<String, Object> FindItemsAndCount(  
            int startRowIndex, int maximumRows,  
            List<GridSortExpression> sortExpression,  
            List<GridFilterExpression> filterExpression)  
        {  
            System.Data.DataTable dt = new System.Data.DataTable();  
            dt.Columns.Add("ID", Type.GetType("System.Int32"));  
            dt.Columns.Add("Name");  
            dt.Columns.Add("Description");  
            dt.Columns.Add("Location");  
 
            for (int i = 0; i < 35; i++)  
            {  
                System.Data.DataRow dr = dt.NewRow();  
                dr["ID"] = i;  
                dr["Name"] = "Name" + i;  
                dr["Description"] = "Description" + i;  
                dr["Location"] = "Location" + i;  
                dt.Rows.Add(dr);  
            }  
 
            return new Dictionary<String, Object>  
            {  
                { "Data", RowsToDictionary(dt, dt.Select(string.Format(" ID > {0} and ID < {1}", startRowIndex.ToString(), (startRowIndex + maximumRows).ToString()))) },  
                { "Count", dt.Rows.Count }  
            };  
        }  
 
        private static List<Dictionary<stringobject>> RowsToDictionary(DataTable table, DataRow[] rows)  
        {  
            List<Dictionary<stringobject>> objs =  
                new List<Dictionary<stringobject>>();  
            foreach (DataRow dr in rows)  
            {  
                Dictionary<stringobject> drow = new Dictionary<stringobject>();  
                for (int i = 0; i < table.Columns.Count; i++)  
                {  
                    drow.Add(table.Columns[i].ColumnName, dr[i]);  
                }  
                objs.Add(drow);  
            }  
 
            return objs;  
        }  
    }  
    [Serializable]  
    public class Field  
    {  
        public String ColumnName { getset; }  
        public String DisplayName { getset; }  
    }  
    public class BoundTemplate : System.Web.UI.ITemplate  
    {  
        public ListItemType templateType;  
        public string columnName, sortExpression;  
 
        public BoundTemplate(ListItemType type, string colName)  
        {  
            templateType = type;  
            this.columnName = colName;  
        }  
 
        public void InstantiateIn(Control container)  
        {  
            switch (templateType)  
            {  
                case ListItemType.Item:  
                case ListItemType.AlternatingItem:  
                    Label dataLabel = new Label();  
                    dataLabel.Text = columnName;  
                    container.Controls.Add(dataLabel);  
                    dataLabel.DataBinding += new EventHandler(Item_DataBinding);  
                    break;  
 
                default:  
                    break;  
            }  
        }  
 
        public void Item_DataBinding(object sender, System.EventArgs e)  
        {  
            Label lbl = (Label)sender;  
            GridDataItem container = (GridDataItem)lbl.NamingContainer;  
            string value = string.Empty;  
              
            value = DataBinder.Eval(container.DataItem, columnName).ToString();  
            lbl.Text = value;  
        }  
    }  
}  
 
Tilak
Top achievements
Rank 1
 answered on 22 Jan 2010
3 answers
193 views
I have a grid that is part of a user control.  Everything is working fine, except when editing an item. When you are inside one of the textbox of the GridBoundColumns and press the "Enter" key, the "Add new record" command button gets pressed and the insert form is opened up.

I guess I could disable the insert button when in edit mode, but I would prefer that the default button when in the editform be the submit button of the editform. 

All the examples I have tried seem to work they way I want them to, but I can't see why my grid behaves differently.

Help or suggestions would be appreciated.

-Steve
Steve Wolfe
Top achievements
Rank 1
 answered on 22 Jan 2010
1 answer
90 views
Hello All,

I installed RadControls_for_ASP.NET_AJAX_2009_3_1314_dev WITHOUT uninstalling RadControls_for_ASP.NET_AJAX_2009_3_1208_dev. That may have been a big mistake. After that my custom "Blue" skin was no longer formatting the RadDock controls correctly. The RadDock controls were drawn with the Title and borders in white making the control box invisible. This had been working correctly in 2009_3_1208.

OK. I uninstalled ALL telerik ASP.NET Ajax controls. Then installed:

RadControls_for_ASP.NET_AJAX_2009_3_1314_dev

1. For the first time since I've been using telerik, the installation did NOT install the controls in the Toolbox.

OK. no biggie, I did it myself.

2. My custom "Blue" skin no longer formatted RadPanel correctly. The collapsible Panels did NOT appear as solid objects. They appeared as links.
 
OK. I reverted to Office2007 skin. Still the RadPanels are not being drawn correctly. I guess I need to adjust some setting. But which one??

See the attached image.

Thanks,

Judy
JUDY LEE
Top achievements
Rank 1
 answered on 22 Jan 2010
1 answer
88 views
Hello,

I've a requirement to implement. I've a tree control with 3000 nodes in it with each node having x child nodes. Now my requirement is that if i uncheck a particular node i want to uncheck all its child nodes. I dint want a postback for that. So i wrote the client side event to do that. But if the child nodes exceeds some 1000 nodes the javascript is not able to handle it and the browser throws error such as "Scripts are continuously running" (dont know the exact error message).

So what i want is that if the selected node's child node is less than 50 (arbitrary) then the event should be handled in the client side and if not then the event should be handled in the server side.

How can i achieve this? Can you give me some sample code for this?

Thank you.
NLV
NLV
Top achievements
Rank 1
 answered on 22 Jan 2010
0 answers
104 views
Hi,

I have one biggest problem regarding the cycle and performing the creation of User folders using some external parameters. Actually i use manager standalone to create userfolders during normal cycle. Similar like this sample.

Normal scenario
-->Page Load (one select button with Image manager is loaded with the page).  
->backside : PageLoad event, the folderuser is created and imagemanager set but not use other personal data from user can be used.
resulting : Folder/User/

Scenario Demanded ( One user input is used to create the folder)
-->Page Load (one select button but Imagemanager is not loaded at this time is not created yet)
-->User define one custom value in Textbox ( or create one ticket to this user)
-->Use select image : the ImageManager is created later 
-->ImageManager is using the user value to create a personalized folder
demanded : Folder/UserName/CustonValue/....or Folder/Username/ticket/

Exist some way to create this scenario using radEditors managers?
Exist some way to delete the created folder if no content is added at clossing?

Regards, Romi.
Pierre
Top achievements
Rank 1
 asked on 22 Jan 2010
2 answers
114 views
I'm creating dynamic menus, but itemclick event just is not fired, i has been reading doc and says NavigateUrl prevents postback but I'm not even using NavigateUrl, i did a little easy test page and the problem persist:

using System; 
using System.Data; 
using System.Configuration; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
using Telerik.Web.UI; 
 
public partial class _Default : System.Web.UI.Page  
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    RadMenu menu = new RadMenu(); 
 
    protected void Page_Init(object sender, EventArgs e) 
    { 
        menu.ItemCreated += new RadMenuEventHandler(menu_ItemCreated); 
    } 
 
    protected override void CreateChildControls() 
    { 
        base.CreateChildControls(); 
        //RadMenu menu = new RadMenu(); 
        menu.ID = "radmenucontrol"
        menu.LoadXml("<Menu><Group Flow='Horizontal'><Item  Text='opc1' /><Item  Text='opc2' /></Group></Menu>"); 
 
        menu.ItemClick += new RadMenuEventHandler(menu_ItemClick); 
        this.Controls.Add(menu); 
 
    } 
 
    void menu_ItemCreated(object sender, RadMenuEventArgs e) 
    { 
        e.Item.Attributes["NavigateUrl"] = e.Item.NavigateUrl; 
        e.Item.NavigateUrl = ""
 
    } 
 
    void menu_ItemClick(object sender, RadMenuEventArgs e) 
    { 
        Response.Write("Item Clicked"); 
          
    } 
 

I tried the ItemCreated event setting NavigateUrl to empty string (just in case) but no succes, i dont know what im doing wrong, any help will be appreciated.




Emmanuel Herrera
Top achievements
Rank 1
 answered on 22 Jan 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?