Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > Insert TAB charecter in Radlistboxitem text

Not answered Insert TAB charecter in Radlistboxitem text

Feed from this thread
  • Jayaprakash avatar

    Posted on Jan 5, 2012 (permalink)

    Hi,

    i have a requirement to display grouped items in radlistbox like below

    General Action
        Transfer
        Document
        Re-Open
    Escalation
        Parts
        Field Involvement
    Other Actions
        Marketing
        Owner Advantage

    i have to load these items in runtime(server side) because based on some conditions i have to disable/enable listitems.Also i have to differentiate the group name and child by font and space like above.
    1.Now i can able to disable items. But i am not able to insert space before the child items. please check the code below which i used to generate these items
    2.For group items if i disable it , the foreground color gets changed to grey. which i want it in black color like above.


    foreach (var group in CASEACTION_GROUPS)
                {
                RadListBoxItem groupListItem = new RadListBoxItem { Text = group, Enabled = false };
                    groupListItem.Font.Bold = true;
                    groupListItem.Font.Italic = true;
                    groupListItem.ForeColor = Color.Black;
                    listBoxCaseActions.Items.Add(groupListItem);
    foreach (var caseActon in caseActions)
                    {
                        var listItem = new RadListBoxItem { Text = caseActon.EntityName, Value = caseActon.ObjectTypeCode };
      
                        if (!caseActon.HasPrivileges)
                        {
                            listItem.Enabled = false;
                            listItem.Text = string.Concat(caseActon.EntityName, CASEACTION_NO_PRIVILEGES);
                        }
                        else if ((caseActon.ObjectTypeCode.Equals("10022") && !_caseStatus.ToLower().Equals(CASE_STATUS_PENDING_CLOSED))) //Close Case
                        {
                            listItem.Enabled = false;
                            listItem.Text = string.Concat(caseActon.EntityName, string.Format(CASEACTION_NOT_AVAILABLE, _caseStatus));
                        }
                        else if (caseActon.ObjectTypeCode.Equals("10051")) //Re-open Case
                        {
                            if (_caseStatus.ToLower().Equals(CASE_STATUS_CLOSED))
                            {
                                this._caseActionsBusinessComponent = _caseActionsBusinessComponent ?? new CaseActionsBusinessComponent();
                                var role = this._caseActionsBusinessComponent.GetUserSecurityRole();
                                if (CASEACTION_USER_ROLE.Where(r => role.ToLower().Contains(r)).Count() > 0)
                                {
                                    listItem.Enabled = true;
                                }
                                else
                                {
                                    listItem.Enabled = false;
                                    listItem.Text = string.Concat(caseActon.EntityName, CASEACTION_NO_PRIVILEGES);
                                }
                            }
                            else
                            {
                                listItem.Enabled = false;
                                listItem.Text = string.Concat(caseActon.EntityName, string.Format(CASEACTION_NOT_AVAILABLE, _caseStatus));
                            }
                        }
      
                        listBoxCaseActions.Items.Add(listItem);
                    }
                }

    Am I missing something.Can anybody help me on this issue.

    Thanks in advance
    Jayaprakash Krishnan

    Reply

  • jumpstart Master avatar

    Posted on Jan 5, 2012 (permalink)

    Jayaprakash:

    If you did not already see this thread, a potential solution for your requirement is available in the Adding Categories In RadListBox forum thread. And, there's a Disabled Item Color Change forum thread specific to the RadListBox that may provide some insights here.

    Hope this helps.

    Reply

  • JAYAPRAKASH avatar

    Posted on Jan 6, 2012 (permalink)

    Jumpstart,
    thanks for your reply.
    i want to do this functionality in server side (C# - aspx.cs -codebehind ).
    please have a look on my code which i have attached earlier.

    Thanks
    Jayaprakash Krishnan

    Reply

  • JAYAPRAKASH avatar

    Posted on Jan 9, 2012 (permalink)

    can anybody help me on the above issue?

    Reply

  • Dimitar Terziev Dimitar Terziev admin's avatar

    Posted on Jan 9, 2012 (permalink)

    Hi Jayaprakash,

    I've prepared a sample page which I believe will help you achieve the desired functionality.

    Regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
    Attached files

    Reply

  • JAYAPRAKASH avatar

    Posted on Jan 10, 2012 (permalink)

    Dimitar Terziev ,

    Thank you very much for ur support.

    your solution solved one problem(indenting child items).but still i could not fix the disabled group item forecolor(BLACK).
    the solution which u provided will make all disabled items forecolor as black.but i want this functionality only for group items, bcz i may have some disabled child items which should retain default grey color.

    Thanks in advance,
    Jayaprakash Krishnan

    Reply

  • Dimitar Terziev Dimitar Terziev admin's avatar

    Posted on Jan 13, 2012 (permalink)

    Hello Jayaprakash,

    In order to achieve the desired functionality you should differentiate the disabled parent items from the child ones. This is why you should add a dummy class and change the color only to those items which has such css class. You could find a sample page attached.

    All the best,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
    Attached files

    Reply

  • JAYAPRAKASH avatar

    Posted on Jan 13, 2012 (permalink)

    Dimitar Terziev,

    I tried the same , but its not working :(
    I have posted the .aspx and attached output screenshot for your reference.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CaseActions.aspx.cs" Inherits="HP.FMC.Mss360CRM.CRM.Presentation.Web.SupportingApps.DefaultHost.Pages.CaseActions" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>
    <%@ 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">
     
        <head runat="server">
            <title>
                Case Actions
            </title>
            <style type="text/css">
                .caseAction
                {
                    margin-left: 15px !important;
                }
                .groupCaseAction
                {
                }
            </style>
            <link rel="stylesheet" href="../Styles/site.css" type="text/css"  />
        </head>
        <body>
            <form id="formCaseAction" runat="server">
                <div style="margin-left: 10px" >
                    <p>
                        <asp:Label ID="lblMessage" runat="server"
                            meta:resourcekey="lblMessageResource1"></asp:Label>
                    </p>
                    <asp:Panel runat ="server" ID="panelCaseAction"
                        meta:resourcekey="panelCaseActionResource1" >
                         
                        <asp:Label ID="labelTitle" runat="server"
                            Font-Bold="True" meta:resourcekey="labelTitleResource1" />
                        <br />
                        <asp:Label ID="labelSubTitle" runat="server"
                            meta:resourcekey="labelSubTitleResource1" />
                        <br />
                        <p>
                        <telerik:RadScriptManager ID="ScriptManager" runat="server" >
                            <Scripts>
                                <asp:ScriptReference Assembly="Telerik.Web.UI"
                                    Name="Telerik.Web.UI.Common.Core.js" />
                                <asp:ScriptReference Assembly="Telerik.Web.UI"
                                    Name="Telerik.Web.UI.Common.jQuery.js" />
                                <asp:ScriptReference Assembly="Telerik.Web.UI"
                                    Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                            </Scripts>
                        </telerik:RadScriptManager>
                        <telerik:RadListBox ID="listBoxCaseActions" Width="500px"  runat="server"
                                meta:resourcekey="listBoxCaseActionsResource1" >
                                <ButtonSettings TransferButtons="All" />
                                <WebServiceSettings>
                                    <ODataSettings InitialContainerName="">
                                    </ODataSettings>
                                </WebServiceSettings>
                            </telerik:RadListBox>
                        <script type="text/javascript">
     
                                Sys.Application.add_load(loadHandler);
     
                                function loadHandler() {
     
                                    var listbox = $find("listBoxCaseActions");
                                    $telerik.$(".groupCaseAction", listbox.get_element()).each(function () {
                                        $telerik.$("span", this).css("color", "black");
                                    });
                                }
                         </script>
                        </p>
                        <asp:Button ID="buttonCreateNew" runat="server"
                            style="margin-top: 10px" meta:resourcekey="buttonCreateNewResource1" />
                        <br />
                    </asp:Panel>
                </div>
            </form>
        </body>
    </html>


    please let me know wht could be the reason.

    Thanks,
    Jayaprakash Krishnan
    Attached files

    Reply

  • Dimitar Terziev Dimitar Terziev admin's avatar

    Posted on Jan 17, 2012 (permalink)

    Hi Jayaprakash,

    I've inspected the information provide, but I'm unable to see where do you add this groupCaseAction class to your parent items. Please show me the code behind that you are using so I could inspect it as well.

    Regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

  • JAYAPRAKASH avatar

    Posted on Jan 19, 2012 (permalink)

    Hi Dimitar Terziev,
        Please find the below code for your reference.
    foreach (var group in CASEACTION_GROUPS)
                    {
                        RadListBoxItem groupListItem = new RadListBoxItem { Text = group, Enabled = false };
                        groupListItem.Font.Bold = true;
                        groupListItem.Font.Italic = true;
                        groupListItem.ForeColor = Color.Black;
                        groupListItem.CssClass = "groupCaseAction";
                        listBoxCaseActions.Items.Add(groupListItem);
    foreach (var caseAction in caseActions)
                        {
                            var listItem = new RadListBoxItem { Text = caseAction.EntityName, Value = caseAction.ObjectTypeCode };
    listItem.CssClass = "caseAction";
                            listBoxCaseActions.Items.Add(listItem);
                        }
                    }

    Thanks,
    Jayaprakash Krishnan

    Reply

  • Dimitar Terziev Dimitar Terziev admin's avatar

    Posted on Jan 23, 2012 (permalink)

    Hello Jayaprakash,

    You implementation seems right and it's very strange that the behavior is not the desired one. In order to troubleshoot this issue could you please try to upload a runnable version of your page and send me a link to download and test it locally?

    Greetings,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListBox > Insert TAB charecter in Radlistboxitem text