.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Error using expressions to define a color in a Custom Color Palette

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :Sql Server
I have a report where I would like to have a parameter define the colors in a custom color palette in SSRS 2008.  Within the CustomPaletteColors property for a chart you can use an expression to define the color.  However, whenever I use the value of a parameter to define the color value, the chart just shows the error message 'Object reference not set to an instance of an object."

I also get the same error message if I try using custom code and reference a function that would retrieve the colors. 

Is this happening because of how the rendering engine is working?  Is this property being defined before the paramters and custom code initialize?  Is it possible to define a custom palette using parameters and custom code?  If so, how?

View Complete Post

More Related Resource Links

Expression to pick a chart series color by ordinal from custom palette



This is probably an easy question but I cannot find a solution to this. The stored procedure that I use to retrieve data for my bar chart in SSRS returns an ordinal number for each row, which represents a group the item belongs to. For example, I get:

Car - 20% - 1
Bus - 10% - 1
Train - 15% - 1
Bike - 3% - 2
Inline skates - 16% - 2

so 1 is all vehicles with an engine, and 2  all vehicles without engine. What I would like to do is to plot a bar with the percentage for each row and in the color of the custom palette, so Car, Bus and Train would get the first color of the user defined palette, Bike and Inline skates would be the second color of the custom palette.

I think I have to use the Choose function in the expression for this but I cannot figure out how to access the custom palette to retrieve all colors.


I know I could retrieve a color code from the database instead of the group ordinal, but I would prefer to have the color being picked from the custom palette; is this possible?

Thank you,



Make a Common Color Palette


What would be the best approach for having all the reports share a color palette.

What i want to achieve is that when we want to change for example the color of our column header i somewhere change a value and all reports are modified. That somewhere might be a config file, a sql table, a registerentry, ....

I know i could change all rdl files but that's nog a approach i want to develop.

Kinds Regards

Achieve Dwm color blurs on custom blurred windows


I've made a picture to describe my question best, as words really could not do it properly this time. The question and notes are included in the picture. http://localhostr.com/files/c7c2fe/Colorization.png

Transcript of notes:

Color Averages:

  • Blur: #FEC1C1
  • Unfocused: #FEC1C1
  • Focused: #DE6868
  • Taskbar: #DC6161

Question: How can I achieve the focused/taskbar color blends on a blur window.


  • The blur window is created with DwmEnableBlurBehindWindow

  • The glass windows are created with DwmExtendFrameIntoClientArea

  • No extra color handling has been done (i.e. rectangles/backgrounds)

  • Average colors calculated by a maximal gaussian blur on the GIMP.

  • Colorization information is obtained with DwmGetColorizationParameters

AJAX Control Toolkit Color Picker Extendor Control Error


Hi All,

I am using visual studio 2008 with 3.5 framework, I tried color picker extendor control for my application. control is not coming to my page. please guide me on this regards.


Thank you




Using a Function from a Custom assembly - An unexpected error occurred while compiling expressions.


LocalReport, SQL 2005, Custom Assembly compiled in Framework 2.0, with this I can add the reference to the report.

Client  (WinForm Framework 4.0)  In the same path of my application, I have the custom assembly (that uses the report)

When I try to get the DataSources, getParameters, or SetParameters, I always get the same error. The LoadDefinition(stream) does not load anything. Any Idea?

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.

I also tried to enable the NetFx40_LegacySecurityPolicy in the config of my application, and nothing change.

If I don't use the Function from the custom assembly I don't have any problem.
Thanks in advance. 

Saving Gray8 with BmpBitmapEncoder results in 256 color palette and 16 color image. Why?


Saving a Gray8 image using the BmpBitmapEncoder doesn't give an error, but does multilate the image.  The header and color table are those of an Indexed8 gray scale image, but the pixels have only 16 possible values 00, 11, 22, ..., DD, EE, FF.  Is this by design?  A FormatConvertedBitmap from Gray8 to Indexed8 and saved using the BmpBitmapEncoder results in the correct image.  This code demonstrates:

    Dim R As New Int32Rect(0, 0, 1024, 768)
Dim B(R.Height - 1, R.Width - 1) As Byte
    For Y As Integer = 0 To R.Height - 1
For X 

Changing background Color of a custom slider when IsEnabled = False (Expression Blend)


I have a customized slider control. When the control is set to IsEnabled=false, the color changes to the default desabled color. How do I change this to a different color in Expression blend? I have tried unchecking IsEnabled property in Expression Blend, and changing the color, but is still takes the default disabled color. 


Would appreciate if anyone knows how to do this using Expression Blend


Thank you


Download and Share Visual Studio Color Schemes

The good news is that Visual Studio allows you to completely customize the editor background and text colors to whatever you want - allowing you to tweak them to create the experience that is "just right" for your eyes and personality. You can then optionally export/import your color scheme preferences to an XML file via the Tools->Import and Export Settings menu command.

Ajax Tab: Each TabPanel with different Color



I have situation like, Each tab panel should display with different colors based on the status. Example:

Completed tabs should display in "Green"

Inprogress status tabs should display in "Red"

Not eligible status tabs should display in "Gray".

Ajax Tab look and feel is very good. So, thought of using the Ajax Tab for my above requirement. I tried to change it. But I am not able to change the color of the each tab.  

Is it possible to change the color of each tab in Ajax Tab control? Pleas help me.

If not possible, please suggest any other tab controls to achieve above my requirement.

Note:I already tried with IE tab controls, since it provides me that flexibility to change the color of the each tab. But, It is crashing my browswer. I am not sure about the reason.

I tried Jquery option, since I need to change the tab status dynamically based on the selection made in that same page, I am not able to achieve this one in the JQuery.

Selected to change the background color of the page



As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.

Custom Control Design-Time SiteMap Provider Error


Greetings - I was referred here by MSDN forums hope this is the right place -  

I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

Error Creating Control - MyControl  The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have discovered that the error is cause by this line of code:

string div = string.Format("<div class='{0}' id='{1}'>{2}</div>", this.CssClass, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));

or more specifically, by the reference to SiteMap.RootNode - I am not clear what is missing thoough because I have configured the SiteMapProvider in web.config as this:

        <add name="AspNetXmlSiteMapProvider" 
             type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

Custom Control Design view error



I have created a custom control from scratch and it works fine as in you can build the project that uses it and it works fine at runtime. Problem is when you go to design view the control shows an error in the place of where the control should be rendered.

Error: '<SomeValue>' Could not be set to '<SomeProperty>'

This shows up on all my custom set properties. These properties are created as basic as possible. I can give the properties values in Source view and run the app just fine. I can even add a Onclick event. If I don't set any custom properties the control will render fine in Design view. It's only when I set a value to a custom property.

Property Code Example:

public string Text
                string ret = "";
                object obj = ViewState["Text"];
                if (obj != null)
                    ret = obj.ToString();
                return ret;
                ViewState["Text"] = value;

I've even removed the Category and Description tags with no difference.

I don't know if what I said makes sens, but I hope it



Hi there,


 I am doing one task on asp.net graphics. i would like to a form that let the user choose the color code from the color picker.

inside my backend code, i can get the color code and convert to the system.drawing.color.



Dim col As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml("#9932CC")

 Dim Brush As New SolidBrush(col)


but i have some problem in make this col object to alpha color. as i know the .net code that make the system color to become alpha is wrote as like tat :

gr.DrawString(strWatermarkText, wmFont, New SolidBrush(Color.FromArgb(8, 0, 0, 0)), x, y)


May someone share me how to make the color input from form to become alpha color? thanx in advanced. hope to hear from you all soon 


Toolbox: Realistic Test Data, Dare Obasanjo's Blog, Color-Coding Tools, and More


This month Scott shows how to generate realistic test data, visits Dare Obasanjo's blog, and demonstrates color coding code for better readability.

Scott Mitchell

MSDN Magazine October 2008

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application


Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004

GDI+: A Primer on Building a Color Picker User Control with GDI+ in Visual Basic .NET or C#


Although most developers and APIs use the RGB scheme when working with colors, it's not the only available way to represent or select colors. For instance, the standard Windows color-selection dialog box allows you to work with the HSL color scheme in an indirect way. In this article, the author describes several color selection schemes, and uses GDI+ (via the System.Drawing namespace) to create a component that makes it possible for your own applications to provide a simpler, friendlier color chooser. Along the way, you'll get tips to help you use GDI+ in your own apps.

Ken Getz

MSDN Magazine July 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend