Whole WebWorksheet is readonly

Hello,

I'm evaluating Aspose grid for a new project and I'm running into a problem. I've successfully added a WebGrid and WebWorksheet to an aspx page and populated the webworksheet with a datatable from a dataset. However every cell in my worksheet is readonly and I need to be able to have a column where a user can enter in a dollar amount for each row in the grid. I've tried the following methods but none of them have seemed to work (note awsDirectReports is my webworksheet object).

GridWeb1.EditMode = true;

awsDirectReports.SetEditableRange(0, 0, 8, 100);

awsDirectReports.IsProtected = false;

awsDirectReports.SetAllCellsEditable();

awsDirectReports.UnfreezePanes();

I have checked out the demo project and those worksheets are not read-only so I went back and compared properties but can't see to find anything different. You help would be much appreciated as we are dealing with a relatively short window to evaluate this. Thanks

Dennis

Hi Dannis,

Thanks for considering Aspose.

I don't find the problem you have mentioned.

Following is my testing code which works fine, I think you can consult it:

private void Page_Load(object sender, System.EventArgs e)

{

if(!this.IsPostBack)

{

string path = MapPath("");

path = path.Substring(0, path.LastIndexOf("\\"));

string fileName = path + "\\File\\TestBook.xls";

// Clears datasheets first.

GridWeb1.WebWorksheets.Clear();

// Imports from an excel file.

GridWeb1.WebWorksheets.ImportExcelFile(fileName);

WebWorksheets sheets = GridWeb1.WebWorksheets;

// Sets all cells readonly first.

sheets[0].SetAllCellsReadonly();

// Starts from A1 to 8 rows and 100 colums in total are not locked.

sheets[0].SetEditableRange(0, 0, 8, 100);

}

}

Thank you.

Thank you for your reply. I can see two things you are doing different but I don't understand why either of these would make a difference for me. My code is posted below. As you can see I'm not loading any info from an excel spreadsheet all my info is coming straight from a dataset. I am also not doing a worksheets.clear because I've already got a worksheet added to my aspx page that has all the proper columns defined in it. Please let me know if you see anything wrong with the code below

GridWeb1.EditMode = true;

GridWeb1.Enabled = true;

GridWeb1.EnableSmartNavigation = true;

Aspose.Grid.Web.Data.WebWorksheet awsDirectReports = GridWeb1.WebWorksheets[0];

awsDirectReports.DataSource = m_dsDirectReports.Tables[0];

awsDirectReports.DataBind();

awsDirectReports.SetEditableRange(0, 0, 100, 8);

awsDirectReports.IsProtected = false;

awsDirectReports.SetAllCellsEditable();

Hi,

it does not matter whether you extract data from dataset or load an excel file, Also does not make any difference to my code if you clear / unclear the worksheets first. I am not very clear about your code, what actually you desire to implement. Seeing you code, nothing would happen, you whole worksheet would be editable. If you want to make only the first 100 rows and first 8 columns i.e. A1: F100 cells editable and all other area in the sheet should be read -only you should code like:

GridWeb1.EditMode = true;

GridWeb1.Enabled = true;

GridWeb1.EnableSmartNavigation = true;

Aspose.Grid.Web.Data.WebWorksheet awsDirectReports = GridWeb1.WebWorksheets[0];

awsDirectReports.DataSource = m_dsDirectReports.Tables[0];

awsDirectReports.DataBind();

awsDirectReports.SetAllCellsReadonly();

awsDirectReports.SetEditableRange(0, 0, 100, 8);

awsDirectReports.IsProtected = false;

//awsDirectReports.SetAllCellsEditable();

If you still could not make it, kindly creat a test project, zip and post it here to show the issue with all the details, we will check it soon.

Thank you.