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

[Solved] RadComboBox Scrollbars

3 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 2
Jim asked on 22 Apr 2008, 02:04 PM
Is there a way to suppress the horizontal scroll bar?  I'm using Prometheus, and no matter how wide I make the DropDownListWidth, the horizontal scrollbar is still visible.

Thanks,
Jim

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 22 Apr 2008, 02:36 PM
Hello Jim,

Could you please paste here the RadComboBox declaration so that we can test your approach at our side and try to find a working solution for you?

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jim
Top achievements
Rank 2
answered on 22 Apr 2008, 02:41 PM

It is all done in code behind.  The rad combo is used as a filter combo for a rad grid.  This is based off one of your demos, I just replaced the asp drop down with a rad grid, I needed to be able to change the dropdownlistwidth.

Here is the class I use:

public

class MyCustomFilteringColumn : GridBoundColumn

{

private object listDataSource = null;

int mintWidth = 0;

int mintListWidth = 0;

public int ListWidth

{

get { return mintListWidth; }

set { mintListWidth = value; }

}

public int Width

{

get { return mintWidth; }

set { mintWidth = value; }

}

//RadGrid will call this method when it initializes the controls inside the filtering item cells

protected override void SetupFilterControls(TableCell cell)

{

base.SetupFilterControls(cell);

cell.Controls.RemoveAt(0);

Telerik.Web.UI.

RadComboBox list = new RadComboBox();

//System.Web.UI.WebControls.DropDownList list = new System.Web.UI.WebControls.DropDownList();

list.ID =

"list" + this.DataField.Replace(" ", "_");

list.Height =

Unit.Pixel(250);

list.AutoPostBack =

true;

//list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);

list.SelectedIndexChanged +=

new RadComboBoxSelectedIndexChangedEventHandler(list_SelectedIndexChanged);

cell.Controls.AddAt(0, list);

cell.Controls.RemoveAt(1);

list.DataTextField =

this.DataField;

list.DataValueField =

this.DataField;

list.DataSource =

this.ListDataSource;

list.DataBind();

//list.Font.Size = FontUnit.XXSmall;

list.Style.Add(

"font-size", "0.5em");

list.Font.Name =

"arial";

//if (mintWidth > 0)

//{

list.Width =

Unit.Percentage(97);

//}

list.DropDownWidth =

Unit.Percentage(125);

if (mintListWidth > 0)

{

}

list.Skin =

"Outlook";

}

//void list_SelectedIndexChanged(object sender, EventArgs e)

void list_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

{

GridFilteringItem filterItem = (sender as RadComboBox).NamingContainer as GridFilteringItem;

this.SelectedValue = (sender as RadComboBox).SelectedValue;

//GridFilteringItem filterItem = (sender as DropDownList).NamingContainer as GridFilteringItem;

//this.SelectedValue = (sender as DropDownList).SelectedValue;

this.FilteredColumnName = this.UniqueName;

if (this.UniqueName == "Index")

{

//this is example for filtering for integer column type

filterItem.FireCommandEvent(

"Filter", new Pair("EqualTo", this.UniqueName));

}

//filtering for string column type

filterItem.FireCommandEvent(

"Filter", new Pair("Contains", this.UniqueName));

}

public void Rebind()

{

}

public object ListDataSource

{

get

{

return this.listDataSource;

}

set

{

listDataSource =

value;

}

}

public string SelectedValue

{

get

{

object res = this.Owner.OwnerGrid.Page.Session["SelectedValue"];

if (res != null)

{

return (string)res;

}

return "";

}

set

{

this.Owner.OwnerGrid.Page.Session["SelectedValue"] = value;

}

}

public string FilteredColumnName

{

get

{

object res = this.Owner.OwnerGrid.Page.Session["FilteredColumnName"];

if (res != null)

{

return (string)res;

}

return "";

}

set

{

this.Owner.OwnerGrid.Page.Session["FilteredColumnName"] = value;

}

}

//RadGrid will call this method when the value should be set to the filtering input control(s)

protected override void SetCurrentFilterValueToControl(TableCell cell)

{

base.SetCurrentFilterValueToControl(cell);

RadComboBox list = (RadComboBox)cell.Controls[0];

//System.Web.UI.WebControls.DropDownList list = (System.Web.UI.WebControls.DropDownList)cell.Controls[0];

if (this.CurrentFilterValue != string.Empty)

{

list.SelectedValue =

this.CurrentFilterValue;

}

}

//RadGrid will call this method when the filtering value should be extracted from the filtering input control(s)

protected override string GetCurrentFilterValueFromControl(TableCell cell)

{

RadComboBox list = (RadComboBox)cell.Controls[0];

//System.Web.UI.WebControls.DropDownList list = (System.Web.UI.WebControls.DropDownList)cell.Controls[0];

return list.SelectedValue;

}

public override GridColumn Clone()

{

return base.Clone();

}

protected override string GetFilterDataField()

{

return this.DataField;

}

}

0
Rosi
Telerik team
answered on 25 Apr 2008, 01:43 PM
Hi Jim,

I suggest that you try setting the DropDownWidth  property in pixels instead of Percentages.

list.DropDownWidth =
Unit.Pixel(125);

Also, you can try using a different Skin and let us known how this goes.


Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Jim
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Jim
Top achievements
Rank 2
Rosi
Telerik team
Share this question
or