implementing a horizontal bar graph in mvc 3 - asp.net-mvc-3

I am relatively new to .Net MVC 3 (using Razor syntax) and I am stuck with a small requirement.
I have a dropdpwn with two string values (Conservative, Moderate) in it. Each string value is associated with its corresponding 'Min', 'Max' and 'Avg' values coming from a Model. Now I have to show a horizontal bar graph with x values (Conservative, Moderate) and y values (0% to 100%). Now whenever I select a dropdown value, the graph should be updated in such a way that, it should color the area between 'Min' and 'Max' values on y-axis for Conservative, Moderate and also display the Min(Eg; 10%) and Max(Eg; 50%) values on the top of it for the selected dropdown value.
Also, the corresponding 'Average' value should be displayed as a pointer on the graph for the Conservative, Moderate (x values) when a checkbox (below the dropdown)is checked.
Thanks!!

You have several ways of doing this (even more than just this)
1. Do it the "MVC" way and use jQuery : ) Everyone is doing it : )
Use one of the jQuery graph plugins:
http://workshop.rs/jqbargraph/
make an ajax call an aspx page where you use a web forms chart control.
Use a partial view as your graph. Put that in an ajax.beginform. Selecting the dropdown values causes a postback to your controller method which packages your data - could be an inline image (you can fully encode the bytes to an image in html, thereby not requiring a separate call to load the image)
simply values that get turned into an html div that mimics a bar chart.
personally - I would choose #1

Related

Data validation on the result of a formula

I'm looking for a way to default a cell value with data validation applied, but allow the user to overwrite the value to one of the valid values allowed.
I have a demo spreadsheet here.
And visually:
I have data validation on column D that provides a list of possible markup percentages from column G, however, I want a default value in there so I have written a formula to work this out (based on there being a value in an adjacent cost cell).
I enter the item, I enter a cost and the markup defaults. All good.
But, when I click the dropdown I don't get any values popup. the formula is shown instead.
I have tried conditional formatting based on making the cell text and background white, but this is sub-optimal for my real world (significantly more complex) scenario.
How can I achieve what I am after - a default value of 50% if there is a cost value, but selectable from the drop-down.
The only way to add a "default" value based on a condition is to use on edit (simple or installable) script.
Example:
The following is an simple on edit trigger. If a cell from column C below the first row is edited, then the cell to the right will be 50% (assuming that the cell format is set to display %)
function onEdit(e){
if(e.range.columnStart === 3 && e.range.rowStart > 1){
e.range.offset(0,1).setValue(0.5);
}
}
Resources
https://developers.google.com/apps-script/guides/sheets
https://developers.google.com/apps-script/guides/triggers

How do I repeat a rectangle as a header on every page in SSRS

I have the following RDL setup: a single rectangle that contains 3 elements (an image, and 2 textboxes). Underneath the rectangle, I have multple tablixes, lets say 3 for now, but this number will increase or decrease dynamically as I am constructing the RDL markup with XML within my .net app. Each tablix will have it's own unique dataset (data and columns differs between the tablixes).
In order to render each tablix on a new page, I went ahead and added a PageBreak:End on each tablix, except the last one. Now, I need the rectangle to be repeated on each page, but how do I do this? I thought that maybe the RepeatWith property could be used, but this only allows a single selected data region. So, the rectangle rendered on page 1 and page 3 (not on page 2).
Any help would be greatly appreciated thanks
You could place the rectangle in the report header to repeat on each page:
https://blogs.msdn.microsoft.com/selvar/2010/12/27/report-headers-and-footers-with-microsoft-sql-server-reporting-services/

Adding a blank page to SSRS

I'm creating a report by account that will either print 2 pages duplex (front and back). But sometimes the amount of data will make it overflow to 3 pages. When that happens I need to make sure a 4th page gets generated (blank) so the next account can print on the front of page 1. How can I accomplish this in VS2010? Thanks.
The answer, like most formatting questions, is to use a Rectangle.
Insert a rectangle, place it after your first table and give it a height of 0.125in. In the Rectangle properties, check Add Page Break After.
Now the problem is with your needing to only use the rectangle's page break when it's on page 2.
Since the Page Number built-in field only works in the header or footer, you need some code for the page number. Add code to get the Page Number to the report code (Report Properties -> Code):
Public Function PageNumber() as integer
Return Me.Report.Globals!PageNumber
End Function
Then set the Rectangle's visibility to Show or Hide based on expression and the expression to:
=IIF(Code.PageNumber() = 3, TRUE, FALSE)

What is the difference between UserControl.Controls and Page.Controls in WebForms?

I have a page with some Controls on it. I'm trying to get all Labels from a page reccursively. But I noticed, that not all Labels are in Page.Controls list or it's child elements.
To get all Labels I need to concat results from UserControl.Controls and UserControl.Page.Controls.
What are the differences between this controls?

Kendo Grid Hierarchy templating issue

My design requires a checkbox as the first column in the grid and subsequent grids, however, using Hierarchy to implement those subsequent grids, the drop down arrow that kendo adds becomes the first column making the column with the checkbox template second. Is there an efficient / official way of getting around this?

Resources