<div class="row">
@{
var mouseMode = Model.MouseModes.FirstOrDefault();
}
@(Html.C1().ReportViewer()
.Id("basicReportViewer")
.ServiceUrl(Model.ServiceUrl)
.FilePath("ReportsRoot/Formatting/AlternateBackground.flxr")
.ReportName("AlternateBackground")
.ZoomFactor(Model.ZoomFactor)
.MouseMode((MouseMode)Enum.Parse(typeof(MouseMode), mouseMode.Value)))
</div>
<br />
<div class="row">
<div class="form-horizontal">
<div class="form-group">
<div class="col-md-3">
<div class="checkbox">
<label>
<input id="basicContinuousViewMode" type="checkbox" /> Continuous View Mode?
</label>
</div>
</div>
<div class="col-md-3">
<div class="checkbox">
<label>
<input id="basicSelectMouseMode" type="checkbox" /> Select Mouse Mode?
</label>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-4 control-label">Mouse Mode</label>
<div class="col-md-8">
@(Html.C1().ComboBox()
.Id("mouseMode")
.Bind(Model.MouseModes)
.SelectedValuePath("Value")
.DisplayMemberPath("Text")
.SelectedIndex(0)
.OnClientSelectedIndexChanged("mouseMode_SelectedIndexChanged"))
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="checkbox">
<label>
<input id="basicFullScreen" type="checkbox" /> Full Screen?
</label>
</div>
</div>
<div class="col-mod-4">
<label class="col-md-2 control-label">Zoom Factor</label>
<div class="col-md-2">
@(Html.C1().InputNumber()
.Id("basicZoomFactor")
.Value(Model.ZoomFactor)
.Min(0.05)
.Max(10)
.Step(0.1)
.Format("n2")
.OnClientValueChanged("basicZoomFactor_ValueChanged"))
</div>
</div>
</div>
</div>
</div>
// basic features
var basicReportViewer = null,
basicFullScreen = null,
basicSelectMouseMode = null,
basicZoomFactor = null,
basicContinuousViewMode = null;
function InitialControls() {
// basic features
basicReportViewer = wijmo.Control.getControl('#basicReportViewer');
basicFullScreen = document.getElementById('basicFullScreen');
basicSelectMouseMode = document.getElementById('basicSelectMouseMode');
basicZoomFactor = wijmo.Control.getControl('#basicZoomFactor');
basicContinuousViewMode = document.getElementById('basicContinuousViewMode');
// fullScreen
basicFullScreen.checked = basicReportViewer.fullScreen;
basicFullScreen.addEventListener('change', function () {
basicReportViewer.fullScreen = this.checked;
});
// continousViewMode
basicContinuousViewMode.checked = basicReportViewer.viewMode == wijmo.viewer.ViewMode.Continuous;
basicContinuousViewMode.addEventListener('change', function () {
basicReportViewer.viewMode = this.checked ? wijmo.viewer.ViewMode.Continuous : wijmo.viewer.ViewMode.Single;
});
};
// basic features
function basicZoomFactor_ValueChanged(sender) {
if (sender.value < sender.min || sender.value > sender.max) {
return;
}
basicReportViewer.zoomFactor = sender.value;
};
// mouseMode
function mouseMode_SelectedIndexChanged(sender){
if (!sender.selectedValue)
return;
basicReportViewer.mouseMode = parseInt(sender.selectedValue);
};
using ReportViewer101.Models;
using System.Collections.Generic;
using System.Web.Mvc;
namespace ReportViewer101.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ReportViewer101Model model = new ReportViewer101Model();
model.ServiceUrl = "https://www.grapecity.com/componentone/demos/aspnet/c1webapi/latest/api/report";
model.ZoomFactor = 1;
model.ReportNames = GetReportNames();
model.Parameters = GetParameters();
model.MouseModes = GetMouseModes();
return View(model);
}
private List GetReportNames()
{
List reportNames = new List();
reportNames.Add(new CmbList("ReportsRoot/Formatting/AlternateBackground.flxr/AlternateBackground", "Alternating Background"));
reportNames.Add(new CmbList("ReportsRoot/Controls/AllCharts.flxr/AllCharts", "All Charts"));
reportNames.Add(new CmbList("ReportsRoot/Controls/CheckBox.flxr/CheckBox", "Check Box"));
reportNames.Add(new CmbList("ReportsRoot/Controls/Shapes.flxr/Shapes", "Shapes"));
return reportNames;
}
private List GetParameters()
{
List parameters = new List();
parameters.Add(new CmbList("1", "Beverages"));
parameters.Add(new CmbList("2", "Condiments"));
parameters.Add(new CmbList("3", "Confections"));
parameters.Add(new CmbList("4", "Dairy Products"));
parameters.Add(new CmbList("5", "Grains/Cereals"));
parameters.Add(new CmbList("6", "Meat/Poultry"));
parameters.Add(new CmbList("7", "Produce"));
parameters.Add(new CmbList("8", "Seafood"));
return parameters;
}
private List GetMouseModes()
{
List mouseModes = new List();
mouseModes.Add(new CmbList("0", "Select Tool"));
mouseModes.Add(new CmbList("1", "Move Tool"));
mouseModes.Add(new CmbList("2", "Rubberband Tool"));
mouseModes.Add(new CmbList("3", "Magnifier Tool"));
return mouseModes;
}
}
}