Insert TAB charecter in Radlistboxitem text

11 posts, 0 answers
  1. Jayaprakash
    Jayaprakash avatar
    4 posts
    Member since:
    Jan 2012

    Posted 05 Jan 2012 Link to this post

    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
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 05 Jan 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. JAYAPRAKASH
    JAYAPRAKASH avatar
    5 posts
    Member since:
    Dec 2011

    Posted 06 Jan 2012 Link to this post

    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
  5. JAYAPRAKASH
    JAYAPRAKASH avatar
    5 posts
    Member since:
    Dec 2011

    Posted 09 Jan 2012 Link to this post

    can anybody help me on the above issue?
  6. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 09 Jan 2012 Link to this post

    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
  7. JAYAPRAKASH
    JAYAPRAKASH avatar
    5 posts
    Member since:
    Dec 2011

    Posted 10 Jan 2012 Link to this post

    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
  8. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 13 Jan 2012 Link to this post

    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
  9. JAYAPRAKASH
    JAYAPRAKASH avatar
    5 posts
    Member since:
    Dec 2011

    Posted 13 Jan 2012 Link to this post

    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
  10. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 17 Jan 2012 Link to this post

    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
  11. JAYAPRAKASH
    JAYAPRAKASH avatar
    5 posts
    Member since:
    Dec 2011

    Posted 19 Jan 2012 Link to this post

    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

  12. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 23 Jan 2012 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017