Free Support Forum -

Displaying a color dropdown in aspose grid web

I am converting an existing ASp.NET design which uses MS grid to use Aspose WebGrid. have a requirement to display a color palette dropdown list in a grid cell. I know how to set the cell’s background color on the client side (in js using cell.orgBgColor=selColor; statement, easy enough, however, my dropdown itself is supposed to have be colored. My grid is data bound to a collection, and grid ‘color’ column is also bound. I can also set the initial BackColor selection on the server side when page renders with no problem, but how can I control the background color in the dropdown popup itself? here is what I use for the bind column to display the popup- currently the “Red|Blue|Green|Yellow|White” all show up on white backgroud on the popup, I need them to be, respectively, on “Red|Blue|Green|Yellow|White” background

<acw:BindColumn Caption=“Color” DataField=“Color” UseAlternativeStyle=“False” Width=“70px” >


In the current MS grid approach, I use a template field with an asp: DropDownList control and assign a style to each ListItem in DropDownList server side:

for (int rowCount = 0; rowCount < ddlColorList.Items.Count; rowCount++)
ddlColorList.Items[rowCount].Attributes.Add(“style”, “background-color:” + SetBackGroundColor(ddlColorList.Items[rowCount].Value));
How would I assign the background color to each item in the GridWeb dropdown? I would hate to still use ASP.Net DropDownList and anchor it to the clicked cell, size it to cell size and then pop it up in response to a cell click, unless there is no other easy way around…

Thanks for your query.

Well, I am afraid, our existing (default) data validation types e.g dropdowns / list do not provide such kind of feature, i.e., to change the background colors of the items in the list/drop downs items. We suggest you to update the html by yourself. For example, you may customize the color you choose. You may also use JQuery plug-in or anything like that etc. for your needs.
So, you may replace the list data validation of GridWeb and use JQuery plug-in to have a colored drop down by using JavaScript etc.

Moreover, you may also try to edit or update the files, e.g "acw_client/fontdlg.htm" and "acw_client/fontdlg_l.htm" at your installation directory of GridWeb to update the segments like.

Font color
by your own JS code for your requirements.

Thank you.