This is a migrated thread and some comments may be shown as answers.

Multiple columns in MultipleValuesResourceControl

1 Answer 35 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 02 Nov 2011, 04:16 AM
I'm using several MultipleValueResourceControls in the AdvancedForm.  I would like to have the flexibility to set the number of columns in the CheckBoxList per MultipleValueResourceControl.  I have one instance of the control where there are only 2 selections and should appear in 1 column, but another with close to 40 that I would like to spread out over 4 columns. 

Can someone please point me in the right direction?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 03 Nov 2011, 01:04 PM
Hi Jason,

You can use the Advanced Templates demo and the related help topic. In code-behind of MultipleValuesResourceControl, you need to comment the override of the Render method of the SemanticCheckBoxList class and then you can set conditionally the RepeatColumns property:
  protected class SemanticCheckBoxList : CheckBoxList
    {
        //protected override void Render(HtmlTextWriter writer)
        //{
        //    writer.WriteBeginTag("ul");
 
        //    writer.WriteAttribute("class", "rsCheckBoxList");
 
        //    writer.Write(HtmlTextWriter.TagRightChar);
 
        //    for (int i = 0; i < RepeatedItemCount; i++)
        //    {
        //        writer.RenderBeginTag(HtmlTextWriterTag.Li);
        //        RenderItem(ListItemType.Item, i, null, writer);
        //        writer.RenderEndTag();
        //    }
 
        //    writer.WriteEndTag("ul");
        //}
    }
 
//* * *
 
 protected void Page_Load(object sender, EventArgs e)
    {
        SemanticCheckBoxList resourceValue = new SemanticCheckBoxList();
        resourceValue.ID = "ResourceValue";      
        
        ResourceValuesPlaceHolder.Controls.Add(resourceValue);
 
        if (resourceValue.Items.Count == 0)
        {
            PopulateResources();
            MarkSelectedResources();
        }
 
       if (resourceValue.Items.Count > 3)
        {
            resourceValue.RepeatColumns = 2;
        }
        if (resourceValue.Items.Count > 6)
        {
            resourceValue.RepeatColumns = 3;
        }
        if (resourceValue.Items.Count > 9)
        {
            resourceValue.RepeatColumns = 4;
        }
       
    }

Also, add the following css fix to your RadScheduler page.
div.RadScheduler .rsAdvancedEdit .rsResourceControls input
       {
           width: auto;
           vertical-align:middle;
       }
       .rsAdvancedEdit label
       {
          text-align:left !important;
          padding-left: 10px !important;
       }
       .rsResourceControls table
       {
           padding-left: 30px !important;
       }
 

Attached is a sample for reference.

All the best,
Peter
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
Tags
Scheduler
Asked by
Jason
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or