Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
56 views

Hello Sir/Madam,

I m using rad grid with item command and selected index changed events now i want whenever i use item commad current row color should be changed as appear in selected index change event


                                                                                           or


or 2nd possibilty is also here that is i m using three rad grids in which 1st grid id is grd_optnandprcng so that whenever i fired item command of fthis grid then second grid data(id="Req_items") and Third grid data(id="opt_items") should not refresh or ajax refersh image should not appear with it but on selected index changed it should be refresh .

 <telerik:AjaxSetting AjaxControlID="grd_optnandprcng">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Req_items"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="opt_items"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>

so please tell me solution of both possibility.

Thanks
Eyup
Telerik team
 answered on 28 Feb 2013
1 answer
122 views
Hi - I am populating a grid from a datatable, with AutoGenerateColumns=true. I have tried using the master table view Tablelayout=auto property and it still resizes the columns to equal widths despite having some columns with long text and others with id values.  I have client side column resizing turned on - could this be interfering with this working correctly?  Thanks for your help
Eyup
Telerik team
 answered on 28 Feb 2013
1 answer
280 views
Hi Team,

I want to apply custom filter on a grid which is created using dynamic template column. For that I refer the 
artical on Custom Option for Filtering but the grid filtering functionality is not working . The ItemCommand code is mentioned here under:

if (e.CommandName == RadGrid.FilterCommandName)
            {
                e.Canceled = true;

                Pair filterPair = (Pair)e.CommandArgument;

                string colName = filterPair.Second.ToString();
                TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox;


                string newFilter = string.Empty;
                newFilter = "[" + filterPair.Second.ToString() + "] like '%" + tbPattern.Text.Trim() + "' OR [" + filterPair.Second.ToString() + "] like '" + tbPattern.Text.Trim() + "%'";


                radGrid1.MasterTableView.FilterExpression = newFilter;
                radGrid1.Rebind();
            }

If I remove the e.Canceled = true; then it works with default filter.

Also i tried with bound column it is working file I think this is issue with template column.

Please let me know what wrong I did ASAP.

Thanks a ton is advance.

Regards,

Manish

The complete code is below.

1 Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridFiltering._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="atk" %>
<%@ 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">
    <atk:ToolkitScriptManager ID="ScriptManager1" EnablePageMethods="true" EnableScriptLocalization="true"
        runat="server" AsyncPostBackTimeout="36000">
   </atk:ToolkitScriptManager>
    <div>
        <telerik:RadGrid ID="radGrid1" runat="server" AutoGenerateColumns="false" EnableLinqExpressions="false"
            AllowFilteringByColumn="true" AllowSorting="true" OnItemCommand="radGrid1_ItemCommand">
            <mastertableview autogeneratecolumns="false" editmode="InPlace" allowfilteringbycolumn="True"
                tablelayout="Auto">
            <Columns>
            </Columns>
        </mastertableview>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>

2 Default.aspx.cs
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.Data;
using System.Configuration;

namespace GridFiltering
{
    public partial class _Default : System.Web.UI.Page
    {
        public bool IsBoundColumn
        {
            get
            {
                bool isBoundColumn = false;
                if (ConfigurationManager.AppSettings["isBoundColumn"] != null)
                    Boolean.TryParse(ConfigurationManager.AppSettings["isBoundColumn"].ToString(), out isBoundColumn);
                return isBoundColumn;
            }

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            radGrid1.Columns.Clear();

            if (IsBoundColumn)
            {
                GridBoundColumn boundColumn = new GridBoundColumn();
                boundColumn.HeaderText = "class";
                boundColumn.DataField = "class";
                boundColumn.AutoPostBackOnFilter = true;
                boundColumn.ShowFilterIcon = false;
                boundColumn.CurrentFilterFunction = GridKnownFunction.EqualTo;
                radGrid1.Columns.Add(boundColumn);
                boundColumn = new GridBoundColumn();
                boundColumn.HeaderText = "SubClass";
                boundColumn.DataField = "SubClass";
                boundColumn.AutoPostBackOnFilter = true;
                boundColumn.ShowFilterIcon = false;
                boundColumn.CurrentFilterFunction = GridKnownFunction.EqualTo;
                radGrid1.Columns.Add(boundColumn);
            }
            else
            {
                GridTemplateColumn ItemTmpField = new GridTemplateColumn();
                ItemTmpField.ItemTemplate = new DynamicallyTemplatedRadGridHandler(GridItemType.Item, "class", InfoType.None, "", null, "string", false);
                ItemTmpField.HeaderTemplate = new DynamicallyTemplatedRadGridHandler(GridItemType.Header, "class", InfoType.Command, "", null, "string", false);
                ItemTmpField.AutoPostBackOnFilter = true;
                ItemTmpField.ShowFilterIcon = false;
                ItemTmpField.CurrentFilterFunction = GridKnownFunction.EqualTo;
                ItemTmpField.DataField = "class";
                radGrid1.Columns.Add(ItemTmpField);

                ItemTmpField = new GridTemplateColumn();
                ItemTmpField.ItemTemplate = new DynamicallyTemplatedRadGridHandler(GridItemType.Item, "SubClass", InfoType.None, "", null, "string", false);
                ItemTmpField.HeaderTemplate = new DynamicallyTemplatedRadGridHandler(GridItemType.Header, "SubClass", InfoType.Command, "", null, "string", false);
                ItemTmpField.AutoPostBackOnFilter = true;
                ItemTmpField.ShowFilterIcon = false;
                ItemTmpField.CurrentFilterFunction = GridKnownFunction.EqualTo;
                ItemTmpField.DataField = "SubClass";
                radGrid1.Columns.Add(ItemTmpField);
            }

            radGrid1.DataSource = CreateDataSource();
            radGrid1.DataBind();
        }

        private DataTable CreateDataSource()
        {
            DataTable dt = new DataTable();
            DataColumn column = new DataColumn("Class", typeof(String));
            Random rd = new Random();
            dt.Columns.Add(column);
            column = new DataColumn("SubClass", typeof(String));
            dt.Columns.Add(column);
            column = new DataColumn("StartDate", typeof(DateTime));
            dt.Columns.Add(column);
            column = new DataColumn("EndDate", typeof(DateTime));
            dt.Columns.Add(column);
            column = new DataColumn("Number", typeof(Decimal));
            dt.Columns.Add(column);

            dt.Rows.Add("abcd", "a", DateTime.Today, DateTime.Today.AddDays(2), rd.Next());
            dt.Rows.Add("abcd", "b", DateTime.Today.AddDays(1), DateTime.Today.AddDays(3), rd.Next());
            dt.Rows.Add("qwer", "a", DateTime.Today.AddMonths(3), DateTime.Today.AddMonths(6), rd.Next());
            dt.Rows.Add("qwer", "b", DateTime.Today, DateTime.Today.AddDays(5), rd.Next());
            dt.Rows.Add("abcd", "c", DateTime.Today, DateTime.Today.AddDays(1), rd.Next());
            return dt;
        }

        protected void radGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.FilterCommandName)
            {
                e.Canceled = true;

                Pair filterPair = (Pair)e.CommandArgument;

                string colName = filterPair.Second.ToString();
                TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox;


                string newFilter = string.Empty;
                newFilter = "[" + filterPair.Second.ToString() + "] like '%" + tbPattern.Text.Trim() + "' OR [" + filterPair.Second.ToString() + "] like '" + tbPattern.Text.Trim() + "%'";


                radGrid1.MasterTableView.FilterExpression = newFilter;
                radGrid1.Rebind();
            }
        }
    }
}


3 Class file(template column etc.)
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.Collections.Specialized;
using System.Data.SqlClient;
using Telerik.Web.UI;
using System.Collections.Generic;

public static class UtilityConstants
{
    public const string HipoFirstName = "HIPO FirstName";
    public const string HipoLastName = "HIPO LastName";
    public const string USERID = "UserId";
}
public enum InfoType
{
    Command = 0,
    Select = 1,
    Include = 2,
    Reason = 3,
    None = 4,
}

public class DynamicallyTemplatedRadGridHandler : ITemplate
{
    #region data memebers

    Telerik.Web.UI.GridItemType ItemType;
    string FieldName;
    InfoType InfoType;
    Boolean AllowSorting = false;
    string JavascriptAlertMethod = string.Empty;
    string[] CollectionInSelectCommand;
    string headerCss = "text-left";
    public static string chkHeaderClientId = string.Empty;
    String ColumnType = String.Empty;
    String Format = String.Empty;
    bool IsHoverTextRequired = false;
    #endregion

    #region constructor

    public DynamicallyTemplatedRadGridHandler(Telerik.Web.UI.GridItemType item_type, string field_name, InfoType info_type, string _JavascriptMethod, string[] _LinkButtonCollectionInSelectCommand, String columnType)
    {
        ItemType = item_type;
        FieldName = field_name;
        InfoType = info_type;
        //AllowSorting = Allow_Sorting;
        JavascriptAlertMethod = _JavascriptMethod;
        CollectionInSelectCommand = _LinkButtonCollectionInSelectCommand;
        ColumnType = columnType;
        Format = GetDataFormat(field_name);
    }

    public DynamicallyTemplatedRadGridHandler(Telerik.Web.UI.GridItemType item_type, string field_name, InfoType info_type, string _JavascriptMethod, string[] _LinkButtonCollectionInSelectCommand, String columnType, bool isHoverTextRequired)
    {
        ItemType = item_type;
        FieldName = field_name;
        InfoType = info_type;
        //AllowSorting = Allow_Sorting;
        JavascriptAlertMethod = _JavascriptMethod;
        CollectionInSelectCommand = _LinkButtonCollectionInSelectCommand;
        ColumnType = columnType;
        Format = GetDataFormat(field_name);
        IsHoverTextRequired = isHoverTextRequired;
    }

    #endregion

    #region Methods

    public void InstantiateIn(Control Container)
    {
        switch (ItemType)
        {
            case Telerik.Web.UI.GridItemType.Header:
                switch (InfoType)
                {
                    case InfoType.Command:
                        HtmlGenericControl htmlGenericControl = new HtmlGenericControl("span");
                        LinkButton header_lnkbtn = new LinkButton();
                        header_lnkbtn.ToolTip = "Click here to sort";
                        header_lnkbtn.CommandName = "Sort";
                        header_lnkbtn.CommandArgument = FieldName;
                        // htmlGenericControl.Attributes.Add("style", "width: 130px;");
                        //CommandName and CommandArgument should be above Replace functionality

                        if (FieldName != null && FieldName.Contains("->"))
                        {
                            htmlGenericControl.Attributes.Add("class", headerCss);
                            ((GridTableHeaderCell)Container).Attributes.Remove("style");
                            ((GridTableHeaderCell)Container).Attributes.Add("style", "text-align: left !important;");
                            string headerName = "<span>";
                            string proxyCompetency = FieldName;
                            int length = 0;
                            while (proxyCompetency.Length > 0)
                            {
                                length += 5;
                                int indexOfArrow = proxyCompetency.IndexOf("->");
                                if (indexOfArrow > 0)
                                {
                                    headerName += String.Format("{0}</span><span class='nested-data' title='' style='padding-left: {1}px; margin-left: {1}px;'>&nbsp;", proxyCompetency.Substring(0, indexOfArrow), length);
                                    proxyCompetency = proxyCompetency.Substring(indexOfArrow + 2);
                                }
                                else
                                {
                                    headerName += String.Format("{0}</span>", proxyCompetency);
                                    break;
                                }
                            }
                            header_lnkbtn.Text = headerName;
                        }
                        else
                        {
                            if ((IsHoverTextRequired) && (FieldName.Length > 40))
                                header_lnkbtn.Text = string.Format("<span>{0}</span><a href='javascript:void(0)' class='table-info' title=\"{1}\"></a>", string.Format("{0}...", FieldName.Substring(0, 37)), FieldName.IndexOf('"') > -1 ? FieldName.Replace("\"", "''") : FieldName);
                            else
                                header_lnkbtn.Text = FieldName;
                        }

                        //header_lnkbtn.Click += new EventHandler(header_lnkbtn_Click);
                        htmlGenericControl.Controls.Add(header_lnkbtn);
                        Container.Controls.Add(htmlGenericControl);
                        break;

                    case InfoType.Include:
                        CheckBox field_headchkbox = new CheckBox();
                        field_headchkbox.ID = "chkHead" + FieldName;
                        chkHeaderClientId = field_headchkbox.ID;
                        if (JavascriptAlertMethod != string.Empty)
                            field_headchkbox.Attributes.Add("onclick", String.Format(JavascriptAlertMethod, chkHeaderClientId));
                        Container.Controls.Add(field_headchkbox);
                        field_headchkbox.CssClass = "align-chkbox-center";
                        break;

                    case InfoType.Select:

                        HtmlGenericControl htmlLabel = new HtmlGenericControl("div");

                        Label lc = new Label();
                        string strColumnName = FieldName;
                        if (strColumnName.Length > 15)
                        {
                            strColumnName = strColumnName.Substring(0, 12) + "...";
                        }
                        lc.Text = "<b>" + strColumnName + "</b>";
                        htmlLabel.Controls.Add(lc);
                        Container.Controls.Add(htmlLabel);

                        HtmlGenericControl htmlCheckbox = new HtmlGenericControl("div");

                        CheckBox field_chkbox = new CheckBox();
                        field_chkbox.ID = "cbHeader" + FieldName;
                        field_chkbox.CssClass = "align-chkbox-center";
                        if (JavascriptAlertMethod != string.Empty)
                            field_chkbox.Attributes.Add("onclick", JavascriptAlertMethod);
                        Container.Controls.Add(field_chkbox);
                        chkHeaderClientId = field_chkbox.ClientID;
                        HiddenField field_hdnbox = new HiddenField();
                        field_hdnbox.ID = "hdn" + FieldName;
                        //field_hdnbox.DataBinding += new EventHandler(OnDataBinding);
                        Container.Controls.Add(field_hdnbox);

                        break;
                    default:
                        Literal header_ltrl = new Literal();
                        header_ltrl.Text = "<b>" + FieldName + "</b>";
                        Container.Controls.Add(header_ltrl);
                        break;
                }
                break;
            case Telerik.Web.UI.GridItemType.Item:
            case Telerik.Web.UI.GridItemType.AlternatingItem:
                switch (InfoType)
                {
                    case InfoType.Command:
                        ((GridTableCell)Container).Attributes.Remove("style");
                        ((GridTableCell)Container).Attributes.Add("nowrap", "nowrap");
                        LinkButton s = new LinkButton();
                        ImageButton edit_button = new ImageButton();
                        edit_button.ID = "edit_button";
                        edit_button.ImageUrl = "~/images/icon_edit.gif";
                        edit_button.CommandName = "Edit";
                        //edit_button.Click += new ImageClickEventHandler(edit_button_Click);
                        edit_button.ToolTip = "Edit";
                        Container.Controls.Add(edit_button);

                        object dataItem = ((GridDataItem)Container.NamingContainer).DataItem;
                        ImageButton delete_button = new ImageButton();
                        delete_button.ID = "delete_button";
                        delete_button.Attributes.Add(UtilityConstants.HipoFirstName, Convert.ToString(DataBinder.GetPropertyValue(dataItem, UtilityConstants.HipoFirstName)));
                        delete_button.Attributes.Add(UtilityConstants.HipoLastName, Convert.ToString(DataBinder.GetPropertyValue(dataItem, UtilityConstants.HipoLastName)));
                        delete_button.CommandArgument = Convert.ToString(DataBinder.GetPropertyValue(dataItem, UtilityConstants.USERID));
                        delete_button.ImageUrl = "~/images/icon_delete_competency.gif";
                        delete_button.CommandName = "Delete";
                        delete_button.CssClass = "margin-left-10";
                        delete_button.ToolTip = "Delete";
                        if (JavascriptAlertMethod != string.Empty)
                            delete_button.OnClientClick = JavascriptAlertMethod;//"ShowModal(this,'HIPO Candidate Delete Warning','Are you sure you want to delete this HIPO Candidate?');return false;";
                        Container.Controls.Add(delete_button);
                        break;
                    case InfoType.Select:
                        HtmlGenericControl htmlDiv = new HtmlGenericControl("div");
                        foreach (string item in CollectionInSelectCommand)
                        {
                            string[] strControl = item.Split(new char[] { '<' });
                            ImageButton selectLink = new ImageButton();

                            // LinkButton selectLink = new LinkButton();
                            selectLink.ID = "img1" + strControl[1].ToString();
                            // selectLink.ID = "lnk1" + strControl[1].ToString();
                            //selectLink.CssClass= "text-center";
                            selectLink.ToolTip = strControl[0].ToString();
                            selectLink.CommandName = strControl[1].ToString();
                            htmlDiv.Controls.Add(selectLink);
                            Container.Controls.Add(htmlDiv);
                        }

                        break;
                    case InfoType.Include:
                        CheckBox field_chkbox = new CheckBox();
                        field_chkbox.ID = "chk" + FieldName;
                        if (JavascriptAlertMethod != string.Empty)
                            field_chkbox.Attributes.Add("onclick", String.Format(JavascriptAlertMethod, chkHeaderClientId));
                        Container.Controls.Add(field_chkbox);
                        field_chkbox.CssClass = "align-chkbox-center";
                        HiddenField field_hdnbox = new HiddenField();
                        field_hdnbox.ID = "hdn" + FieldName;
                        field_hdnbox.DataBinding += new EventHandler(OnDataBinding);
                        Container.Controls.Add(field_hdnbox);
                        break;
                    case InfoType.Reason:
                        Label field_lblReason = new Label();
                        field_lblReason.ID = "lbl" + FieldName;
                        //field_lblReason.ToolTip = FieldName;
                        field_lblReason.CssClass = "wordwrap";
                        field_lblReason.Text = String.Empty;
                        field_lblReason.DataBinding += new EventHandler(OnDataBinding);
                        Container.Controls.Add(field_lblReason);

                        RadToolTip radTooltip = new RadToolTip();
                        radTooltip.ID = "rad" + FieldName;
                        radTooltip.Animation = ToolTipAnimation.Slide;
                        radTooltip.RelativeTo = ToolTipRelativeDisplay.Mouse;
                        radTooltip.ShowEvent = ToolTipShowEvent.OnMouseOver;
                        radTooltip.ContentScrolling = ToolTipScrolling.Auto;
                        radTooltip.HideEvent = ToolTipHideEvent.LeaveTargetAndToolTip;
                        radTooltip.TargetControlID = field_lblReason.ID;
                        radTooltip.DataBinding += new EventHandler(OnDataBinding);
                        Container.Controls.Add(radTooltip);
                        break;
                    default:
                        Label field_lbl = new Label();
                        field_lbl.ID = System.Guid.NewGuid().ToString();
                        field_lbl.ToolTip = FieldName;
                        field_lbl.CssClass = "width-120 wordwrap";
                        field_lbl.Text = String.Empty;
                        field_lbl.DataBinding += new EventHandler(OnDataBinding);
                        Container.Controls.Add(field_lbl);
                        //}
                        break;

                }
                break;
            case Telerik.Web.UI.GridItemType.EditItem:
                if (InfoType == InfoType.Command)
                {
                    LinkButton s = new LinkButton();
                    ImageButton save_button = new ImageButton();
                    save_button.ID = "edit_button";
                    save_button.ImageUrl = "~/images/save-icon.gif";
                    save_button.CommandName = "Save";
                    //edit_button.Click += new ImageClickEventHandler(edit_button_Click);
                    save_button.ToolTip = "Save";
                    Container.Controls.Add(save_button);

                    ImageButton cancel_button = new ImageButton();
                    cancel_button.ID = "delete_button";
                    cancel_button.ImageUrl = "~/images/struct/cancel-icon.png";
                    cancel_button.CommandName = "Cancel";
                    cancel_button.CssClass = "margin-left-10";
                    cancel_button.ToolTip = "Cancel";
                    if (JavascriptAlertMethod != string.Empty)
                        cancel_button.OnClientClick = JavascriptAlertMethod;//"ShowModal(this,'HIPO Candidate Delete Warning','Are you sure you want to delete this HIPO Candidate?');return false;";
                    Container.Controls.Add(cancel_button);


                }
                else// for other 'non-command' i.e. the key and non key fields, bind textboxes with corresponding field values
                {
                    TextBox field_txtbox = new TextBox();
                    field_txtbox.ID = FieldName;
                    field_txtbox.MaxLength = 512;
                    field_txtbox.Text = String.Empty;
                    field_txtbox.CssClass = "width-75";
                    field_txtbox.DataBinding += new EventHandler(OnDataBinding);
                    Container.Controls.Add(field_txtbox);

                }
                break;
            case Telerik.Web.UI.GridItemType.Footer:
                Label field_lbl_footer = new Label();
                field_lbl_footer.ID = FieldName;
                field_lbl_footer.Text = String.Empty; //we will bind it later through 'OnDataBinding' event
                field_lbl_footer.DataBinding += new EventHandler(OnDataBinding);
                Container.Controls.Add(field_lbl_footer);
                break;

        }

    }

    /// <summary>
    /// Method returns format of data to be shown in grid
    /// </summary>
    /// <param name="columnName"></param>
    /// <returns></returns>
    public String GetDataFormat(string columnName)
    {
        return "";
    }

    #endregion

    #region Event Handlers

    private string GetUserId(object obj)
    {
        return obj.ToString();
    }
    private void OnDataBinding(object sender, EventArgs e)
    {

        object bound_value_obj = null;
        Control ctrl = (Control)sender;
        GridDataItem data_item_container = (GridDataItem)ctrl.NamingContainer;
        bound_value_obj = DataBinder.GetPropertyValue(data_item_container.DataItem, FieldName);
        switch (ItemType)
        {
            case Telerik.Web.UI.GridItemType.Item:
                if (sender.GetType().ToString() == "System.Web.UI.WebControls.HiddenField")
                {
                    HiddenField hdn_field = sender as HiddenField;
                    hdn_field.Value = bound_value_obj.ToString();
                }
                else if (sender.GetType().ToString() == "Telerik.Web.UI.RadToolTip")
                {
                    RadToolTip rad_field = sender as RadToolTip;
                    if (bound_value_obj.ToString().Trim().Length > 25)
                    {


                        rad_field.Text = bound_value_obj.ToString();
                    }
                    else
                    {
                        rad_field.Visible = false;
                    }

                }
                else
                {
                    Label field_ltrl = (Label)sender;
                    string strName = string.Empty;
                    strName = bound_value_obj.ToString();
                    if (FieldName == "Employee Name" || FieldName == "Manager Name" || FieldName == "Nominator Name" || FieldName == "Calibrator Name")
                    {
                        if (strName.IndexOf(",") == 0 || strName.IndexOf(",") == strName.Length - 1)
                        {
                            strName = strName.Replace(",", "");
                        }
                    }
                    if (FieldName == "Employee Name" && ((System.Data.DataRowView)(data_item_container.DataItem)).DataView.Table.Columns["UserId"] != null)
                    {
                        string UID = GetUserId(DataBinder.Eval(data_item_container.DataItem, "UserId"));
                        string uri = field_ltrl.ResolveClientUrl("~/CandidateProfile/Profile.aspx");
                        string LINK = "<a title='Click here to view candidate profile' href=" + uri + "?showBack=" + "1" + "&uid=" + UID + ">" + strName + "</a>";
                        field_ltrl.Text = LINK;
                        field_ltrl.ToolTip = "";
                    }
                    else if (FieldName.ToUpper() == "Title".ToUpper() && ((System.Data.DataRowView)(data_item_container.DataItem)).DataView.Table.Columns["RowNumber"] != null)
                    {
                        string RowNumber = GetUserId(DataBinder.Eval(data_item_container.DataItem, "RowNumber"));
                        string uri = "~/EmployeePortal/RoleProfile.aspx";
                        uri = field_ltrl.ResolveClientUrl(uri);
                        string LINK = "<a title='Click here to view Positions/Roles/Committees' href=" + uri + "?showBack=" + "1" + "&RowNumber=" + RowNumber + ">" + strName + "</a>";
                        field_ltrl.Text = LINK;
                        field_ltrl.ToolTip = "";
                    }
                    else if (FieldName.ToUpper() == "REASON")
                    {
                        string str = string.Empty;
                        str = Convert.ToString(bound_value_obj);
                        if (str.Length > 25 && ctrl.ID == "lblReason")
                        {
                            str = str.Substring(0, 25);
                            str = str + "...";
                            field_ltrl.Text = str;
                            field_ltrl.ToolTip = bound_value_obj.ToString();
                        }
                        else
                        {
                            if (ColumnType.Trim().Equals("DateTime", StringComparison.InvariantCultureIgnoreCase))
                                str = Convert.ToDateTime(str).ToString("MM/DD/YYYY");

                            field_ltrl.Text = String.Format("{0} {1}", str, Format);
                        }
                    }
                    else if (FieldName == "Notes")
                    {
                        string UID = GetUserId(DataBinder.Eval(data_item_container.DataItem, "UserId"));
                        string noteText = DataBinder.Eval(data_item_container.DataItem, "Notes").ToString();
                        string uri = field_ltrl.ResolveClientUrl("~/CandidateProfile/Note.aspx");
                        string LINK = "<a title='Click here to view candidate note' href=" + uri + "?uid=" + UID + "&SearchText=" + noteText + ">View</a>";
                        field_ltrl.Text = LINK;
                        field_ltrl.ToolTip = "";
                    }
                    else if ((FieldName == "Date Started") || (FieldName == "Rotation Date (Low)*") || (FieldName == "Rotation Date (Mid)*") || (FieldName == "Rotation Date (High)*"))
                    {
                        if (string.IsNullOrEmpty(strName))
                        {
                            strName = "NA";
                            field_ltrl.Text = strName;
                        }
                        else
                        {
                            field_ltrl.Text = strName;// String.Format("{0} {1}", strName, Format);
                        }

                        field_ltrl.CssClass = "";
                        GridTableCell td = field_ltrl.Parent as GridTableCell;
                        td.Attributes.Add("class", "text-left");
                        td.Attributes.Add("tdalign", "left");
                    }
                    else
                    {
                        if (ColumnType.Trim().Equals("DateTime", StringComparison.InvariantCultureIgnoreCase) && strName != "" && strName != ConfigurationManager.AppSettings.Get("MultipleValueText"))
                            strName = Convert.ToString(Convert.ToDateTime(strName).ToString("MM/dd/yyyy"));
                        if (strName == "")
                        {
                            strName = "NA";
                            field_ltrl.Text = strName;
                        }
                        else
                            field_ltrl.Text = String.Format("{0} {1}", strName, Format);

                        //double Num;
                        //bool isNum = double.TryParse(strName, out Num);
                        //if (isNum)
                        if ((ColumnType.Trim().Equals("Numeric", StringComparison.InvariantCultureIgnoreCase)) || (ColumnType.Trim().Equals("DateTime", StringComparison.InvariantCultureIgnoreCase)))
                        {
                            field_ltrl.CssClass = "";
                            GridTableCell td = field_ltrl.Parent as GridTableCell;
                            td.Attributes.Add("class", "text-center wordwrap");
                            td.Attributes.Add("tdalign", "center");
                        }
                        else
                        {
                            field_ltrl.CssClass = "";
                            GridTableCell td = field_ltrl.Parent as GridTableCell;
                            td.Attributes.Add("class", "width-150 wordwrap");
                        }
                    }
                }
                break;
            case Telerik.Web.UI.GridItemType.EditItem:

                TextBox field_txtbox = (TextBox)sender;
                field_txtbox.Text = bound_value_obj.ToString();


                break;
        }


    }

    #endregion


}

Eyup
Telerik team
 answered on 28 Feb 2013
1 answer
172 views
Hello,
We would like to utilize a well established framework such as twitter bootstrap.  When we tried twitter bootstrap found that when the telerik controls did not render well using it.  A ticket was submitted but never resolved.  

We are now starting another project and we are going to be using the telerik controls in it.  What frameworks work the best with Telerik?

Thanks.
Bozhidar
Telerik team
 answered on 28 Feb 2013
2 answers
90 views
We have a requirement to save the user specific named settings for RadGrid in DB.

User may set his default setting for the RadGrid and when the particular user gets logged in the default settings what he has set before
would be applied to the grid he had set.

The settings can be handled from this feature are like :-
Global Settings : Font, Height of the Row, Font Style etc.
Group/Grid specific Settings : Filter, Sorting, Grouping etc.

So there setting are being saved in DB and when the specific user got o the page where the particular RadGrid exists.
it applies the settings to teh RadGrid by fetching values from DB.
To do this i have created an user control having appropriate properties to be assigned when
added to the page like the grid name on which the settings to be applied etc.
On page Init i have to set the property to which we have to assign the value as the current grid on which settings to be applied.
Ex :-
  
ucGridSettingsManager.MyGrid = radGrid;

ucGridSettingsManager - The user control used to apply the settings, which will be placed at the top right side of the grid header.
User can click on it to view all the settings available for him by previous creations.
MyGrid - Property which needs to be set as the grid on which the settings to be applied.
radGrid - Grid on which the settings to be applied or saved.


It is working fine if the RadGrid is bounded on server-side, but when it is bounded at client-side the
particular setttings are not working good.

Can anybody help me in this regard ?
Maria Ilieva
Telerik team
 answered on 28 Feb 2013
1 answer
63 views
Hi
After updating to the latest control set every page containing GridView was throwing an error, this was due to the fact that we use custom localization source.
To fix that could we get a default language pack for DropDownList it in some readable key-value format so we can update our language set's ?
Dimitar Terziev
Telerik team
 answered on 28 Feb 2013
1 answer
157 views
I am using a RadListBox to display the result of names from a search. I am binding the RadListbox to my datatable.  If the user doesn't provide any filters, the result would be around 10,000 records. 

If the search result have over X number of names, how can I show something similar to the "ShowMoreResultsBox" as in a Combobox?  I would like to have about 200 names to display in the RadListbox, anything over would like the "ShowMoreResultsBox". 

I am using version 2013 Q1 and using VB.NET to program.

Thanks!
Nencho
Telerik team
 answered on 28 Feb 2013
3 answers
65 views
Hi

I have implemented some custom code (which came from elsewhere on the site) as I want the data in the headers to appear over the relevant column.  I get a problem when using the Frozen columns feature in that after horizontally scrolling to the right and then back to the left the contents of the columns shifts to the right.  I've posted a couple of screenshots below.  I can see that a colspan is added to the first column in the header row as the view is scrolled back.  Anyone seen this before? 

Versions are : asp.net 4.0, Windows 7, I.E. 8.0.7601.17514, RadGrid 2012.3.1308.40.

Thanks

Before


After


Code for setting up the group header:

protected void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridGroupHeaderItem)
        {
            (e.Item as GridGroupHeaderItem).DataCell.Visible = false;
            e.Item.PreRender += new EventHandler(Item_PreRender);
        }
    }
 
    void Item_PreRender(object sender, EventArgs e)
    {
        GridGroupHeaderItem groupHeader = sender as GridGroupHeaderItem;
 
        if (groupHeader != null)
        {
            for (int i = 3; i < groupHeader.OwnerTableView.RenderColumns.Length; i++)
            {
                if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnOne")
                {                   
                    groupHeader.Cells[i - 1].Text = string.Format("<nobr>{0}</nobr>", "One");
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnTwo")
                {
                    groupHeader.Cells[i - 1].Text = "Two";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnThree")
                {
                    groupHeader.Cells[i - 1].Text = "Three";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnFour")
                {
                    groupHeader.Cells[i - 1].Text = "Four";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnFive")
                {
                    groupHeader.Cells[i - 1].Text = "Five";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnSix")
                {
                    groupHeader.Cells[i - 1].Text = "Six";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnSeven")
                {
                    groupHeader.Cells[i - 1].Text = "Seven";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnEight")
                {
                    groupHeader.Cells[i - 1].Text = "Eight";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnNine")
                {
                    groupHeader.Cells[i - 1].Text = "Nine";
                }               
            }
        }
Angel Petrov
Telerik team
 answered on 28 Feb 2013
1 answer
44 views
inside radAccommodation_DetailTableDataBind
events get radcombobox id.using findcontrol and bind combobox
Princy
Top achievements
Rank 2
 answered on 28 Feb 2013
3 answers
137 views
I just went to create a new custom skin and noticed the builder still hasn't been updated.

Any idea when it'll be updated?
Bozhidar
Telerik team
 answered on 28 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?