Free Support Forum - aspose.com

Help to make databinding work

Hi,

I'm trying to make databinding work in a GridWeb(1.9.3.0,basic grid, nothing set).
I've construct a dataAdapter to a network SQL Server with all the command(select,add,..).
I bind the data by:

Webworksheet sheet=gridweb.webworksheets[0];
sheet.datasource= adapter.Fill(MyDataTable);
sheet.CreateAutoGeneratedColumns();
sheet.DataBind();

Everything is going fine till here.
I then change the value in a couple of rows and update my dataTable by clicking the submit button, which trigger the code:

adapter.Update((DataTable) sheet.DataSource);

Which is not working because all the row in sheet.DataSource as the state "unchanged".
What am I missing? Is there some configuration to be carefull in the grid or the dataAdapter?

thanks for any help

Hi,

Thanks for considering Aspose.

Do you updating the data source from remote machine? For security reasons, Data Updation is operational for the local users only. Do you get some error when you click the submit button to update the data source and what is the error. You should have complet read/write access rights otherwise you will get the error.

Could you create a sample test project (You may use Access database for your sample), zip it and post us here to show the issue and to reproduce the problem, Also, please mention your environment, OS, Browser, .Net framework, IIS settings etc.

Thank you.

Hi,
thanks for your help.
Before sending you the demo, I've some questions.

What do you mean by "Data Updation is operational for the local users only"?
I've two networked windows 2003 server: one for IIS 6.0 (where the gird run) and one for SQL Server 2005.
Is this a local setting? Can an external user update the database from his IE with this setting?

Just to make sure we understand each other, I get no error nowhere. I get no error when I click the submit button. I also get no error to pull the data out of the database.
I had to dig with the debugger in the row state of sheet.dataSource to identify the problem.


I use a connection string in the dataAdapter with the right credential, and set impersonate="true" in the web.config.

Hi,

We will get back to you soon.

Thank you.

Hi,
I've attach a very very simplistic example.
I'm unable to make it work.
Please help me, I'm discourage.

Hi,

I have found 2 errors in your code.

1. The DataBind routine should be put in the Page_Load event handler and should be called only once by checking the IsPostBack property.

2. The update command of the adapter need one more parameter.

I have corrected them for you. Now it works fine.

Thank you very very much for your help.
It also works fine me now.
Your product is great, but, for a new comer like, assembling all the part (dataadapting,...) can be tricky.
Thank you, I will have never make without your help.

Thanks to your correction, I also find the problem in my real project.

I was configuring my grid in a class, let say :

configureGridClass config= new configureGridClass(GridWeb);

thus getting a bad pointer to the grid in my submit event.
I move the configuration logic in the codebehind, and now it works fine.

thanks again