Free Support Forum - aspose.com

How to define color for scrollbar in the WebGrid?

i tried to define the color using ScrollBarBaseColor and ScrollBarArrowColor, but it does not work, so how can i do that ?

Hi,

If you want to change any style properties of the control, you should set the GridWeb.PresetStyle to PresetStyle.Custom first.

Check the API doc and see the ViewerStyleTemplate class. This class contains all the style properties of the GridWeb control.

i used like this :
Grid.PresetStyle = Aspose.Grid.Web.PresetStyle.Custom;
Grid.CustomStyleFileName = “GridStyle.xml”;

and in the GridStyle.xml, wrote :
ScrollBarBaseColor="#FF0000"

but the scrollbar does not change the color to Red.

i think i find why, WebGrid do not get style file from virtual path ("/xxx/css/style.xml") for CustomStyleFileName, when i use the absolute path like “c:\style.xml”, it works.

Hi,

You may try to change the ScrollBarBaseColor property directly in the property box of the vs.net.

Where do you put the GridStyle.xml? You may use relative path or physical path. For examples, if you put the file on the save path of the aspx file, you may use it's file name directly. If you put the file on any other drive path, you should give the full drive path,

Grid.CustomStyleFileName = "C:\\mystyles\\GridStyle.xml";

Hi,

You may try to change the ScrollBarBaseColor property directly in the property box of the vs.net.

Where do you put the GridStyle.xml? You may use relative path or physical path. For examples, if you put the file on the save path of the aspx file, you may use it's file name directly. If you put the file on any other drive path, you should give the full drive path,

Grid.CustomStyleFileName = "C:\\mystyles\\GridStyle.xml";

If these

thanks, i find it.
but if i have already defined like this in the global css file :

body
{
scrollbar-face-color: #CAC7A0;
scrollbar-arrow-color: #ECECE5;
}

then the scrollbar color in WebGrid does not work any more.

how can i make it work ?

Hi,

Because the control's scroll bar doesn't define its scrollbar-face-color, it inherits the property of the control or the control's parent or the body. You may use the control's style collection to override the scrollbar-face-color property.

GridWeb1.Style["scrollbar-face-color"] = "#FF0000";

And you may put the style settings in the aspx file:

ok, thank u