Hi
I would like to access the active sheet of the current document (ASP.NET - MVC - cshtml) in the View. I have been trying to use the following code:
JavaScriptfunction ChangeCellValue(s, e) {
$.ajax({
url: '@Url.Action("Test", "Home")',
//How do I get access to the activeSheet here ?
data: { activeCellColumnIndex: s.GetSelection().activeCellColumnIndex, activeCellRowIndex: s.GetSelection().activeCellRowIndex },
contentType : 'application/html; charset=utf-8' ,
dataType: "text",
traditional: true,
success: function (result) {
alert(result);
},
});
}
C#@Html.DevExpress().Spreadsheet(
settings =>
{
settings.Name = "Spreadsheet";
settings.CallbackRouteValues = new { Controller = "SpreadsheetAPI", Action = "CellValuePartial" };
settings.Width = Unit.Percentage(100);
settings.Height = 475;
settings.ActiveTabIndex = 0;
settings.EnableClientSideAPI = true;
settings.PreRender = (s, e) =>
{
MVCxSpreadsheet spreadsheet = (MVCxSpreadsheet)s;
DXWebApplication2.Controllers.CellValueDemoHelper.PrepareWorksheet(spreadsheet.Document.Worksheets[0]);
};
settings.ClientSideEvents.SelectionChanged = "ChangeCellValue"
}
).GetHtml()
public ActionResult Test(int activeCellColumnIndex, int activeCellRowIndex )
{
System.Diagnostics.Debug.WriteLine(SelRange);
string str = "activeCellColumnIndex = " + activeCellColumnIndex + "activeCellRowIndex = " + activeCellRowIndex ;
return Content(str);
}
Basically I am trying to get the current selection (client-side) of the active sheet as a Range data type. I want to access the selected range (multiple cells) similar to the following:
worksheet.Cells["B5"].
so that I can perform custom actions on the selected range.
For this, I require :
- Access to the client-side selected range as a Range datatype (of devexpress.spreadsheet) in the controller.
OR
2.Access to the active sheet in the controller.
Many thanks,
Sunaina