Meanwhile , I just want to ask you another question. I’m trying to get the current worksheet (mouse) selected cells in a server side function. The event is fired on an ASP button click. My code line is :
With the new GridWeb version, I do not have the Javascript onclick issue anymore but unfortunatly I still have my rendering problem...
Here are my browser configurations :
browser mode : IE9
document mode : IE9
Waiting for your help,
Thanks,
We have further reviewed your code, but we still could not reproduce the bug/issue, so, we recommend please check your code again and make sure that you are using latest version of the product and update the acw_client folder files.
If I have to specify the row/col indices then I can't understand the difference between :
WebCells webcells = (WebCells)((ArrayList)GridWeb1.SelectCells; and WebCells webCells = GridWeb1.WebWorksheets[0].Cells;
Perhaps you could help me with that.
I asked that question because I need to get only the cell values which are selected by the user.
Well, GridWeb.SelectCells is used to retrieve the selected cells on the GridWeb a user selects. When you use GridWeb.WebWorksheets[0].Cells --> it refers to get all the initialized cells of the worksheet.
About the rendering issue, I tried to fix it by using the 2.7.10.2001 gridweb version. However I still have the problem.
To be sure that the problem is not caused by my own computer, I tried to execute that project on another computer and the bug was reproduced too.
I really don't know what to do to fix it...
We are sorry but I am afraid we still could not find your issue. We tried several times and on different machines but we could not find your issue. We used IE (version, 8,9 etc.), FireFox, Google Chrome and other browsers and it works fine on everywhere.
It looks really strange that it does not works fine on your end. We have re-opened your issue again. Once we have any update on it for you, we will let you know here.
Well, GridWeb.SelectCells is used to retrieve the selected cells on
the GridWeb a user selects. When you use GridWeb.WebWorksheets[0].Cells
–> it refers to get all the initialized cells of the worksheet.
When I’m trying to cast it by using ArrayList as you advised me in your previous post, the compiler display that’s it’s impossible to cast a WebCellArea in ArrayList.
So when I’m using the SelectCells field the only one thing I can have is a WebCellArea Object. That one can give me the bound of my selection.
Thereby taking account of that, is there a possibility to build with the GridWeb API a WebCells collection by using that bound?
Amjad Sahi:
We are sorry but I am afraid we still could not find your issue. We
tried several times and on different machines but we could not find
your issue. We used IE (version, 8,9 etc.), FireFox, Google Chrome and
other browsers and it works fine on everywhere.
It looks
really strange that it does not works fine on your end. We have
re-opened your issue again. Once we have any update on it for you, we
will let you know here.
About my rendering issue, I hope you will reproduce the bug and you will give me some news.
When I'm trying to cast it by using ArrayList as you advised me in your previous post, the compiler display that's it's impossible to cast a WebCellArea in ArrayList. So when I'm using the SelectCells field the only one thing I can have is a WebCellArea Object. That one can give me the bound of my selection. Thereby taking account of that, is there a possibility to build with the GridWeb API a WebCells collection by using that bound?
I tested your scenario with a sample test case using the latest version v2.7.9.xxxx of GridWeb and found the issue as you have mentioned.
I can find the exception: Unable to cast object of type 'Aspose.Cells.GridWeb.Data.WebCellArea' to type 'System.Collections.ArrayList' using the following code. I just select a few cells on the GridWeb and process the code, it gives me error as you pointed out.
Sample code: e.g
//I placed an ASP.NET button named Button1. In Page_Load event, I placed a simple code segment. I imported a simple file and then did sink events for the button's click.
protected void Page_Load(object sender, EventArgs e) { //if first visit this page clear GridWeb1 if (!IsPostBack) { GridWeb1.WebWorksheets.ImportExcelFile("e:\\test2\\List.xls"); Button1.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();"; } }
protected void Button1_Click(object sender, EventArgs e) { if (GridWeb1.SelectCells != null && GridWeb1.SelectCells.Count > 0) { int sRow = ((WebCell)((ArrayList)GridWeb1.SelectCells[0])[0]).Row; //Exception raised here. int sCol = ((WebCell)((ArrayList)GridWeb1.SelectCells[0])[0]).Column; int eRow = ((WebCell)((ArrayList)GridWeb1.SelectCells[GridWeb1.SelectCells.Count - 1])[0]).Row; int eCol = ((WebCell)((ArrayList)GridWeb1.SelectCells[0])[GridWeb1.SelectCells.Count - 1]).Column;
for (int i = sRow; i <= eRow; i++) { for (int j = sCol; j <= eCol; j++) { Response.Write("Cell: " + GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex].Cells[i, j].Name + " Value: " + GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex].Cells[i, j].StringValue); } }
}
I have logged a ticket with an id: CELLSNET-41070 for your issue. We will look into it soon.
When I'm trying to cast it by using ArrayList as you advised me in your previous post, the compiler display that's it's impossible to cast a WebCellArea in ArrayList.
So when I'm using the SelectCells field the only one thing I can have is a WebCellArea Object. That one can give me the bound of my selection.
Thereby taking account of that, is there a possibility to build with the GridWeb API a WebCells collection by using that bound?
About my rendering issue, I hope you will reproduce the bug and you will give me some news.
Thanks, Romain
Hi,
We have checked the source code.
The data type of GridWeb1.SelectCells is ArrayList, and data type of its’ child is WebCellArea
List webcells = new List(); WebCellArea wca = (WebCellArea)GridWeb1.SelectCells[0]; for (int i = wca.StartRow; i <= wca.EndRow; i++) { for (int j = wca.StartColumn; j <= wca.EndColumn; j++) { webcells.Add(GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex].Cells[i, j]); } } WebCells webCells = (WebCells)webcells;
As you can see, first, I get the WebCellArea which is in fact the bound of my user select. Then, I get all the WebCell selected and I add them in an Array of WebCell. Finally, I try to cast the List to a WebCells object and obviously it does not work.
My question was :
Is there a possibility to do that in another way with the aim of having at the end a WebCells object?
I found that WebCells constructor is hidden due to protection level, so you cannot cast it into WebCells.
Why do you want to cast the List into WebCells? You can just use the List for your needs.
Hi,
I was just asking that question because I wrote some methods which handle WebCells object but indeed if there is no solution to do that, I will adapt that methods to deal with a List of WebCell.
Thank you for your help, Now I wait for your help about the GridWeb rendering issue.