1366×768 is not a resolution you should be using (or targeting), and some ASPxDashboadViewer hackery

Just a rant today…

My screen resolution on my work laptop is 1920×1080, but my boss uses 1366×768. That’s a crap resolution. Since he demos the web applications we work on, on his machine, that frequently means that we have to target that resolution. Specifically, we have to target that height, which is really annoying.

I spent the last couple of days adding a simple print receipt window to a web site (that was written in Node.js, which I had to learn – it’s different to .Net.) And then reworking it, because the print button at the bottom of the page gets cut off at that height. I think I’ve got it now, but still, this is annoying. You really shouldn’t be targeting that kind of height, not when your web site will be used on a PC anyway…

I recently also developed some pretty looking dashboards (that are displayed using the devExpress ASPxDashboardViewer), which I also had to squish into a height that would display nicely on his machine…

Actually I have a post in mind regarding the dashboards, but it would unfortunately take more work, and thus time, to write it than what I have to spare. My problem with designing the dashboards was, I did them in the WinForms designer at runtime, but then the ASPxdashboardViewer doesn’t raise the events I needed on the web. There are two ways to design dashboards – the DataLoading event, which is what I need to load a custom data source at runtime, is not raised when dashboards are designed this way. My potential post is about the workaround. Here’s the short version…

  • Design the dashboards at runtime in Winforms.
  • Edit the XML. Delete the data connections. Trash everything in the data sources XML other than their names.
  • Remove any table or view names from the field names. (I used views at design time, but stored procedures at runtime.)
  • Tada! The dashboard XML is now identical to dashboards designed the other way, and will raise the DataLoading event on the web (with the data source name for each separate dashboard inside the viewer), at which point we can then call the right stored procedures etc.

(I did this because the wizards to create a dashboard at design time do not work on my machine. Even if that were not the case, I like designing them at runtime. It’s easy.) Btw, modifying the XML sounds more difficult than it is… In takes me less than one minute to make those changes; obviously after copying the XML file to my web site directory, so I always have both versions. The WinForms viewer is nothing more than an empty form (derived from their custom type) with their dashboard designer component dropped onto it, and docked to fill the form.

The full post, if I write it, will have to contain a script to create a sample database with data – as well as the views to use for the design time dashboards and the stored procedures for the runtime dashboards, because I wouldn’t want to oversimplify this with object data. Then I’d have to describe exactly, and with clarity, how to modify their generated XML. (Although you should be able to get it right from my short description above.) All that will take at least a couple of hours, and that sadly is something I don’t have.


About Jerome

I am a senior C# developer in Johannesburg, South Africa. I am also a recovering addict, who spent nearly eight years using methamphetamine. I write on my recovery blog about my lessons learned and sometimes give advice to others who have made similar mistakes, often from my viewpoint as an atheist, and I also write some C# programming articles on my programming blog.
This entry was posted in General, Programming, Work and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s