We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

C# gridweb, saving a recently updated cell

I am converting an old web application that was using an office 2003 web control.
I’m trying to make the functionality in gridweb be the same as the old office version.
I can load a csv file into a gridweb, I can save the gridweb out to a csv file.
Works fine when you type something into a cell and then click a different cell before saving.
It doesn’t seem to work if you change a cell and you don’t click somewhere else. I’m not sure if there is a way to change the way it works, it seems like whatever you type in a cell isn’t committed until you leave the cell and switch to a different cell.
Anyway to force it to accept this change?
My save button is a separate control on the web page that calls the C# backend code to do the save.

@MoopMeep,

Which version of Aspose.Cells.GridWeb you are using? Also, we do know on how do you save to CSV in code using GridWeb. We recommend using latest version of Aspose.Cells.GridWeb (v22.4). In case, you still the issue, kindly do create a sample (runnable) VS.NET project, zip the project and post us to evaluate your issue on our end, we will check it soon.

Uploading: WebApplication6.zip…

Hi:
Here is an example, I had to delete some of the lib directories in Aspose.Cells.GridWeb.22.4.0 since the upload has a limit.

I made a new web project and pasted in a gridweb control. I also put in an aspx button.
I am using the latest gridweb for this demo (not loading license)
Set a breakpoint in the button click on Console.WriteLine(“foo”);
run the application and type something in cell A1, click the button that says button.
In the debugger watch at GridWeb1 and see that cell A1 doesn’t have the text you just typed in.
rerun the application and type something in cell A1, click a different cell like A2 and the click the button that says button.
In the debugger watch GridWeb1 and see that cell A1 has the text you just types in.

In case the upload doesn’t work, here is the code

webpage
<%@ Page Language=“C#” AutoEventWireup=“true” CodeBehind=“WebForm1.aspx.cs” Inherits=“WebApplication6.WebForm1” %>
<%@ Register assembly=“Aspose.Cells.GridWeb” namespace=“Aspose.Cells.GridWeb” tagprefix=“acw” %>

backend code:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Aspose.Cells.GridWeb;
using Aspose.Cells.GridWeb.Data;

namespace WebApplication6
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FileStream stream = null;
}

    protected void Button1_Click(object sender, EventArgs e)
    {
        Console.WriteLine("foo");
    }
}

}

I think this is by design and behavior of GridWeb.

Could you please create a sample VS.NET web project, zip the project with all the resource files and upload to some file sharing service (e.g. Google drive, dropbox) and share download link. We will check your issue soon.

https://drive.google.com/file/d/1bjHSKM--E68pvfAeyiQeIqC5jWpg_RSJ/view?usp=sharing

https://www.dropbox.com/s/df8fs4130gv16q6/WebApplication6.zip?dl=0

Link for dropbox, google drive complains about the file with no reason given.

@MoopMeep,

Thanks for sharing sample.

You need to register your ASP.NET button to sink events to obtain GridWeb data. Please add a line in the Page_Load event, e.g.

Button1.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();";
protected void Page_Load(object sender, EventArgs e)
        {

            FileStream stream = null;

            Button1.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();";

        }

I have tested after adding this line and it works fine.

Thanks, yes that looks like it works for me too.

Thanks for your help

@MoopMeep,

It is nice to know that the suggested line of code works for your needs. Feel free to write us back if you have further queries or comments, we will be happy to assist you soon.