-
Notifications
You must be signed in to change notification settings - Fork 3
/
Index.cshtml
66 lines (61 loc) · 2.13 KB
/
Index.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@using E3352.Models
@using System.Web.UI.WebControls
@{
ViewBag.Title = "Home Page";
}
<script type="text/javascript">
function ExportToPDF() {
var names = GetSelectedItemNames();
if (!names) {
alert("Choose columns to export");
return;
}
document.getElementById("ExportColumnsNames").value = names;
document.forms[0].submit();
}
function GetSelectedItemNames() {
var selectedItems = columnNames.GetSelectedValues();
var result = "";
for (var index = 0; index < selectedItems.length; index++) {
result += selectedItems[index] + ";";
}
return result;
}
</script>
@{
string[] exportColumnsNames = ViewData["ExportColumnsNames"] == null
? new string[] { "FirstName", "LastName" }
: ViewData["ExportColumnsNames"] as string[];
}
@using (Html.BeginForm("ExportTo", "Home"))
{
<div style="padding: 10px;">
<br />
@Html.DevExpress().Button(settings => {
settings.Name = "exportToPdf";
settings.Text = "Export to PDF";
settings.ClientSideEvents.Click = "function(s, e) { ExportToPDF(); }";
}).GetHtml()
@Html.Hidden("ExportColumnsNames", null)
</div>
<div style="float:left;">
@Html.DevExpress().Label(settings => {
settings.Name = "title";
settings.Text = "Export columns: ";
}).GetHtml()
</div>
<div style="float:left; padding-left: 10px; padding-right: 10px;">
@Html.DevExpress().ListBox(settings => {
settings.Name = "columnNames";
settings.Properties.SelectionMode = ListEditSelectionMode.CheckColumn;
settings.Height = Unit.Pixel(225);
foreach(string name in TestModel.GetPropertyNames()){
settings.Properties.Items.Add(name);
settings.Properties.Items.FindByText(name).Selected = exportColumnsNames.Contains(name);
}
}).GetHtml()
</div>
<div>
@Html.Partial("_GridViewPartial", TestModel.GetDS())
</div>
}