Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
212 views
In the web.config we can set a global skin:
<add key="Telerik.Skin" value="Office2007"/>
And in the code behind we can do the equivalent:
RadSkinManagerMain.Skin = "Office2007";
But in the web.config we can also set a global skin for a particular control type:
<add key="Telerik.ComboBox.Skin" value="Metro" />
Is there an equivalent to this that can be used in the code behind through RadSkinManager?
Angel Petrov
Telerik team
 answered on 18 Feb 2013
5 answers
1.0K+ views
Hi, could you provide me with an example for the next scenario:

I want to have a combobox populated with items from a Db. The items should all have a checkbox which initially is checked. The user can check or uncheck the boxes if necessary. On postbacks I want to check which items are checked. I have an example which is static, but I can easily replace it with dynamic items. The main "problem" I have, when checking items, the RadComboxBox shows the items in the "TextBox" which is displayed at the top of the RadComboBox (next to the arrow). How can I initially set the value for this "TextBox" and also how can I disable this "TextBox" so users cannot type anything (I tries Allowcustomtext=disabled), because the users are only to allowed to select items which are in the list.

I.e. the list is populated which names of persons, initially I want to have all the names checked and the "TextBox" should say: "Selected all". As described before, the user can select or deselect persons. If not all items are selected, the "TextBox" should show the list of persons who are checked, separated by a comma.

I hope I made myself clear. How will I accomplice this, and is the state maintained in postbacks. I'm using a AJAX-fied webapplication
Nencho
Telerik team
 answered on 18 Feb 2013
1 answer
96 views
i used rad grid upto 2 inner level based on grouping. my problem is in inner grid i want to show only some columns not all columns?
Shinu
Top achievements
Rank 2
 answered on 18 Feb 2013
3 answers
91 views
Hi,
I'm new on this forum and have just bought the Telerik ASP Ajax controls.
I have started using the Scheduler and have a problem.

I want the scheduler to selected the same rows that are hovered (using the property NumberOfHoveredRows).
So when the user clicks in the scheduler the rows are selected by automatic. As it is now only one row is selected.

Is this possible to do by javascript somehow?

I can only find the function get_selectedSlots() not set_selectedSlots().

Please help me as I need to have this to work!

Regards Kristian
Boyan Dimitrov
Telerik team
 answered on 18 Feb 2013
1 answer
110 views
I created the columns and groupcolumn dynamically, but when export the grid, the error below appears:


Invalid column group configuration! Column "Code" cannot be after column "Name"

So I put the IsPostBack event (see below), and the error not appears more, but the group header not appear in file exported.

if (!Page.IsPostBack)
{
 columnGroup = grdDados.MasterTableView.ColumnGroups.FindGroupByName(row["Nome"].ToString());
if (columnGroup == null)
{
 columnGroup = new GridColumnGroup();
 columnGroup.HeaderText = row["Nome"].ToString();
 columnGroup.Name = row["Nome"].ToString();
 grdDados.MasterTableView.ColumnGroups.Add(columnGroup);
}

Help-me!!!!

Kostadin
Telerik team
 answered on 18 Feb 2013
1 answer
82 views
Hi,

can i change panel label, i.e, "ALL FIELDS", "FILTER FIELDS", "ROW FIELDS". i nedd apply the localization.

Thanks!

Kostadin
Telerik team
 answered on 18 Feb 2013
2 answers
123 views
Often seen on the first (asynchronous) load.  In the Firefox console, I see this

[11:42:31.052] The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature. @ https://.../Dashboard/ChartImage.axd?UseSession=true&ChartID=6a20948d-8463-41a9-9282-158c82e54707_chart_ctl00$campaignChart&imageFormat=Png&random=3e42c05b-36d6-43bb-aa0a-9f202bb8b2cd

If I don't get the error, I don't see that log.

What we're doing is pretty standard: 

Control ascx
<telerik:RadChart ID="campaignChart" runat="server" DefaultType="Bar" Skin="Web20" Width="150px" Height="230px"
       PlotArea-YAxis-Appearance-MinorGridLines-Visible="false"  PlotArea-YAxis-Appearance-MajorGridLines-Visible="false"
        PlotArea-XAxis-Appearance-MajorTick-Visible="false" PlotArea-XAxis-Appearance-LabelAppearance-Visible="false"
         PlotArea-YAxis-Appearance-MinorTick-Visible="false" >
 
       </telerik:RadChart>

Code behind C#

List<lastCampaignActivityStats> chartData = new List<lastCampaignActivityStats>();
 chartData.Add(new lastCampaignActivityStats("total", total));
 ...
 chartData.Add(new lastCampaignActivityStats("clicked", clicked));
 
 
 ChartSeries emailChartSeries = new ChartSeries();
 emailChartSeries.Type = ChartSeriesType.Bar;
 
 //styles for disabling all the default
 emailChartSeries.Appearance.Border.Visible = false;
 emailChartSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
 emailChartSeries.Appearance.DiameterScale = 1;
 emailChartSeries.Appearance.TextAppearance.Visible = false;
 emailChartSeries.Appearance.LabelAppearance.Visible = false;
 emailChartSeries.Appearance.LabelAppearance.LabelConnectorStyle.Visible = false;
 
 
 campaignChart.Appearance.Border.Visible = false;
 campaignChart.ChartTitle.Visible = false;
 campaignChart.ChartTitle.Appearance.Visible = false;
 campaignChart.Legend.Visible = false;
 campaignChart.Legend.Appearance.Visible = false;
 campaignChart.PlotArea.Appearance.Dimensions.Margins = new Telerik.Charting.Styles.ChartMargins(10, 0, 10, 50);
 campaignChart.PlotArea.Appearance.Border.Visible = false;
 campaignChart.IntelligentLabelsEnabled = false;
 
 
 
 //data source
 campaignChart.DataSource = chartData;
 //add series
 campaignChart.Series.Add(emailChartSeries);
 campaignChart.Series[0].DataYColumn = "Value";
 campaignChart.Series[0].PlotArea.YAxis.LabelStep = 5;
 
  campaignChart.DataBind();

Except that it's asynchronously loaded - the data can take a while to be available via a WebHandler
           /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler" /> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext" /> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            using (var writer = new StringWriter())
            {
                var pageHolder = new Page();
                var control = (UserControl)pageHolder.LoadControl("~/Dashboard/UserControls/LastEmailCampaignActivity.ascx");
                pageHolder.Controls.Add(control);
                context.Server.Execute(pageHolder, writer, false);
                context.Response.ContentType = "text/html";
                context.Response.Write(writer.GetStringBuilder().ToString());
            }
        }

Ves
Telerik team
 answered on 18 Feb 2013
13 answers
1.4K+ views
Here's the situation: I have a "load on demand" RadComboBox that loads item on "ItemsRequested".  When the selected value changes, it also controls the value of a TextBox via Ajax (AjaxSettings setup in RadAjaxManagerProxy).  To handle setting the TextBox value, the combo's AutoPostBack="true".  Everything works fine except this scenario:

1. Page initially loads; RadComboBox has no items so the first time user clicks the dropdown, the "ItemsRequested" will fire.
2. User clicks the dropdown which fires the "ItemsRequested" event as expected.
3. Instead of choosing a value, user clicks anywhere else on the form (outside of the dropdown panel).
4. Page does an Ajax PostBack for some reason even though there is no event (that I can trap) that is fired.
5. The fact that the PostBack is fired, it clears the TextBox.  If I take out the AjaxSetting that has the combo controlling the TextBox, the TextBox maintains it's value.

My biggest question is why would the page postback when the RadComboBox does NOT appear to actually be firing a server side event?
Hristo Valyavicharski
Telerik team
 answered on 18 Feb 2013
8 answers
421 views
I have the following control (as well as others) on my page

<telerik:RadComboBox ID="ddlItemType" runat="server" ToolTip="Item Type" Width="157px"
            TabIndex="50" />

This works fine, but if I set the control the Simple Rendering mode:

<telerik:RadComboBox ID="ddlItemType" runat="server" ToolTip="Item Type" Width="157px" RenderingMode="Simple"
            TabIndex="50" />

The control does not tab correctly. When the focus is on the previous control, and I tab, it moves past this control, and onto the control with TabIndex 60.

Is there another property I need to apply for TabIndexes in Simple mode? I've checked the markup that is rendered onto the page, and the TabIndex is not being set at all.
Nencho
Telerik team
 answered on 18 Feb 2013
2 answers
163 views
Hi Telerik Team,

I'm starting using Telerik, but since this is a first project that i have in hands, i'm having many problems getting started.

I just browser the examples online and i found 2 that would be perfect:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx

The problem is that i need to generate the grid completely in codebehind, so i don't know in advance what the columns would be, how many i will have and what type they will be. I will need to have Text boxes, HTML editors, an image upload field (and show that image on the grid, etc.)

So far i have this, but with many problems:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
    <title>ASP.NET Grid Demo - Automatic Operations</title>
     
    <style>
 
        .MyImageButton
        {
            cursor: hand;
        }
 
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
 
 
    </style>
</head>
 
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
     
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
    
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
          
            function RowDblClick(sender, eventArgs)
            {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
 
            function gridCreated(sender, args)
            {
                if (sender.get_editIndexes && sender.get_editIndexes().length > 0)
                {
                    document.getElementById("OutPut").innerHTML = sender.get_editIndexes().join();
                }
                else
                {
                    document.getElementById("OutPut").innerHTML = "";
                }
            }
 
        </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel lID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
 
    <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" PageSize="10"
        AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted"
        OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound">
 
        <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
 
        <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" HorizontalAlign="NotSet" AutoGenerateColumns="False">
         
            <Columns>
 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
 
            </Columns>
 
 
 
 
            <EditFormSettings ColumnNumber="2" CaptionDataField="Objecto_ID" CaptionFormatString="Edit properties of Product {0}"
                InsertCaption="New Product">
                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3"
                    Width="100%"></FormMainTableStyle>
                <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px">
                </FormTableStyle>
                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                    UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                </EditColumn>
                <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnRowDblClick="RowDblClick" OnGridCreated="gridCreated"></ClientEvents>
        </ClientSettings>
    </telerik:RadGrid>
 
 
 
    <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px"></telerik:GridTextBoxColumnEditor>
    <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px"></telerik:GridTextBoxColumnEditor>
    <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px"></telerik:GridDropDownListColumnEditor>
    <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px"></telerik:GridNumericColumnEditor>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
 
 
    <br />
 
    </form>
</body>
</html>

And the code behind:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using Telerik.Web.UI;
 
public partial class _Default : System.Web.UI.Page
{
 
    SqlDataSource SqlDataSource1 = new SqlDataSource();
    SqlDataSource SqlDataSource2 = new SqlDataSource();
 
 
    protected void Page_Init(object sender, EventArgs e) {
 
 
         
    }
 
    
    protected void Page_Load(object sender, EventArgs e)
    {
 
 
        SqlDataSource1.ConnectionString = "Data Source=DATA_SOURCE;Initial Catalog=DATABASE;user=USER;password=PASS;Integrated Security=false; Connection Timeout=30";
        SqlDataSource1.SelectCommand = "SELECT Objecto_ID, fk_Designacao, Descricao FROM Objecto";
         
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "Objecto_ID" };
        RadGrid1.DataSource = SqlDataSource1;
        RadGrid1.Skin = "Metro";
 
 
        SqlDataSource2.ConnectionString = "Data Source=DATA_SOURCE;Initial Catalog=DATABASE;user=USER;password=PASS;Integrated Security=false; Connection Timeout=30";
        SqlDataSource2.SelectCommand = "SELECT Designacao FROM Designacao";
 
        RadGrid1.Columns.Clear();
 
 
        GridEditCommandColumn c_Edit = new GridEditCommandColumn();
        c_Edit.UniqueName = "EditCommandColumn";
        RadGrid1.MasterTableView.Columns.Add(c_Edit);
 
 
        GridBoundColumn c_gridBound = new GridBoundColumn();
        c_gridBound.DataField = "Objecto_ID";
        c_gridBound.HeaderText = "Objecto ID";
        c_gridBound.SortExpression = "Objecto_ID";
        c_gridBound.UniqueName = "Objecto_ID";
        c_gridBound.ColumnEditorID = "GridTextBoxColumnEditor1";
        RadGrid1.MasterTableView.Columns.Add(c_gridBound);
 
 
        GridDropDownColumn c_gridBoundDrop = new GridDropDownColumn();
        c_gridBoundDrop.DropDownControlType = GridDropDownColumnControlType.RadComboBox;
        c_gridBoundDrop.DataField = "fk_Designacao";
        c_gridBoundDrop.HeaderText = "Designacao Objecto";
        c_gridBoundDrop.SortExpression = "fk_Designacao";
        c_gridBoundDrop.ListTextField = "fk_Designacao";
        c_gridBoundDrop.ListValueField = "fk_Designacao";
        c_gridBoundDrop.UniqueName = "fk_Designacao";
        c_gridBoundDrop.ColumnEditorID = "GridDropDownColumnEditor1";
        RadGrid1.MasterTableView.Columns.Add(c_gridBoundDrop);
 
 
        GridHTMLEditorColumn c_HTML = new GridHTMLEditorColumn();
        c_HTML.DataField = "Descricao";
        c_HTML.SortExpression = "Descricao";
        c_HTML.UniqueName = "Descricao";
        c_HTML.ColumnEditorID = "Descricao";
        c_HTML.HeaderText = "Descricao";
        c_HTML.FooterText = "HTMLEditorColumn footer";
        c_HTML.HeaderStyle.Width = 200;
        RadGrid1.MasterTableView.Columns.Add(c_HTML);
 
 
        GridButtonColumn c_delete = new GridButtonColumn();
        //c_delete = new ImageButton();
        c_delete.ConfirmText = "Delete this product?";
        c_delete.ConfirmTitle = "Delete";
        //c_delete.ButtonType = c_delete_button;
        //c_delete.ConfirmDialogType = RadWindow;
        c_delete.CommandName = "Delete";
        c_delete.Text = "Delete";
        c_delete.UniqueName = "DeleteColumn";
        RadGrid1.MasterTableView.Columns.Add(c_delete);
 
         
    }
 
    protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        String id = item.GetDataKeyValue("Objecto_ID").ToString();
 
        if (e.Exception != null)
        {
            e.KeepInEditMode = true;
            e.ExceptionHandled = true;
            SetMessage("Product with ID " + id + " cannot be updated. Reason: " + e.Exception.Message);
        }
        else
        {
            SetMessage("Product with ID " + id + " is updated!");
        }
    }
 
    protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
    {
        if (e.Exception != null)
        {
            e.ExceptionHandled = true;
            SetMessage("Product cannot be inserted. Reason: " + e.Exception.Message);
        }
        else
        {
            SetMessage("New product is inserted!");
        }
    }
 
    protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        String id = dataItem.GetDataKeyValue("Objecto_ID").ToString();
 
        if (e.Exception != null)
        {
            e.ExceptionHandled = true;
            SetMessage("Product with ID " + id + " cannot be deleted. Reason: " + e.Exception.Message);
        }
        else
        {
            SetMessage("Product with ID " + id + " is deleted!");
        }
    }
 
    protected void RadioCheckedChanged(object sender, System.EventArgs e)
    {
        //switch ((sender as RadioButton).ID)
        //{
        //    case "RadioButton1":
        //        {
        //            RadGrid1.MasterTableView.EditMode = GridEditMode.EditForms;
        //            RadioButton2.Checked = false;
        //            break;
        //        }
        //    case "RadioButton2":
        //        {
        //            RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;
        //            RadioButton1.Checked = false;
        //            break;
        //        }
        //}
        RadGrid1.Rebind();
    }
    protected void CheckboxCheckedChanged(object sender, System.EventArgs e)
    {
                     
        //RadGrid1.AllowMultiRowEdit = CheckBox1.Checked;
                     
        RadGrid1.Rebind();
    }
 
    private void DisplayMessage(string text)
    {
        RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
    }
 
    private void SetMessage(string message)
    {
        gridMessage = message;
    }
 
    private string gridMessage = null;
    protected void RadGrid1_DataBound(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(gridMessage))
        {
            DisplayMessage(gridMessage);
        }
    }
 
    private void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
         
    
}

The Objecto table as a foreign key ft_Designacao, that is on Designacao table. So, when in edit mode i should have a dropdownlist with all the values from Designacao, but with the correct one selected for a specific record.

My problems:

- the RadAjaxLoadingPanel doesn't show when i click something
- the GridDropDownColumn doesn't show the value on the grid and on edit mode (it's empty)
- when i'm on edit mode on a record, i cannot click another record to edit it
- when i'm on edit mode on a record, the save and cancel buttons don't work (the events are not fired...)
- the HTML editor doesn't have the value that is shown on the grid and i can't write on it
- i still need to add an image to the grid and the option to upload a file on edit mode

I'm really desperating :( Telerik has many great examples but i can't find any with all the features i need. I need to completely generate a grid, with an unknow column cound, unknow column type, all this in code behind. I need to have text boxes, drop dow lists, check boxes, text validator boxes (for numbers for instance), HTML editor areas, image upload, etc. Also, the image needs to be shown on the grid.

This is my first project, and i have a really short deadline. And i'm really desperating because i've spend days broswing samples and i still have nothing, as this is a bit daunting to me, to start from scratch.

So, if someone would be kind enought to give a look at my code, point me on the right direction, or, the ideal, to send me a simple sample template where all this is created and works on code behind, i would be extremely grateful.

Thank you so much in advance!
Kostadin
Telerik team
 answered on 18 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?