Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
141 views
I was wondering if there was a way to open the grid to edit all the rows at once - similar to like opening a spreadsheet and on save I can loop through and I can update each row on my own ?
Shinu
Top achievements
Rank 2
 answered on 25 Jan 2010
17 answers
398 views
Hi. I have a hierarchial grid with a custom insert form. The form is opened when a user clicks on an 'insert' link in the grid. These 'insert' links are found at the end of each row in selected grids in the hierarchy. How do I extract a value from the row that a user clicks the 'insert' on. I already know how to extract the primary key. Thanks.

Daniel
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 25 Jan 2010
2 answers
80 views
Hi, everyone.

I have this problem. I don't have to put the .png picture as the background image in my combo box item.
Any body can help me?

Thanks in advance,
Nasri.
Arteta Sam
Top achievements
Rank 1
 answered on 25 Jan 2010
9 answers
1.1K+ views
Hi,

I doubt this is a Telerik Ajax problem but wondered if anyone can shed any light...

Lastest Q2 Ajax build - I am simply loading content from a panelbar link using ajax and then storing the link ID in session for any updates. All is good and everything works as it should locally [iis 5]

However on the live site the session values are being lost and the update does not work. I have outputed the session variables to a label as a test and can see them. But.... If I refresh the page once the sessions variables remain but if I refresh again they are gone!

If I disable ajax then all is OK.

Most odd.

All help most appreciated.

Cheers, Jon
Bill
Top achievements
Rank 1
 answered on 23 Jan 2010
1 answer
152 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
199 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
173 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
448 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
102 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<string, object>> RowsToDictionary(DataTable table, DataRow[] rows)  
        {  
            List<Dictionary<string, object>> objs =  
                new List<Dictionary<string, object>>();  
            foreach (DataRow dr in rows)  
            {  
                Dictionary<string, object> drow = new Dictionary<string, object>();  
                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 { get; set; }  
        public String DisplayName { get; set; }  
    }  
    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
204 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?