swapna
October 11, 2007, 1:40am
1
hi,
iam binding data from dataset to sheet.
iam using formulas here. when i click on submit button its displaying all formula values. but when i click on save button its saving only the values came from databse. its not saving the values generated by formulas
ima sending one attachament with this . check it out once and please rectify my problem
swapna
Hi,
Thanks for your project, we will get back to you soon.
Thank you.
swapna
October 11, 2007, 4:21am
3
hi
my project is going to complete , if you give the solution as possible as early we can purchase the grid.
we have to show the project on monday to client so please give me the solution as possible as early. we are using ajax in this applicaion.
thanks
swapna
henry
October 12, 2007, 2:38am
4
Hi,
The grid doesn't save the formula caculating result to the dataset automatically. You should implement this manually. Here is a sample:
Set formulas after DataBinding:
// Bind the sheet to the dataset. GridWeb1.DataBind();
for (int row = 3; row <= sheet.Cells.MaxRow; row++) {
// Sets formulas for the 7th column. sheet.Cells[row, 6].Formula = "= A" + (row+1).ToString() + " * 1.4"; } GridWeb1.WebWorksheets.RunAllFormulas();
Set values before updating the database:
// Updates the datarows with the caculated value. WebWorksheet sheet = GridWeb1.WebWorksheets[0]; for (int row = 3; row <= sheet.Cells.MaxRow; row++) { DataRowView rowView = (DataRowView)sheet.GetRowBindObject(row); rowView["UnitPrice"] = sheet.Cells[row, 6].Value; }
GridWeb1.WebWorksheets.RunAllFormulas(); DemoDatabase db = new DemoDatabase(); string path = MapPath("."); path = path.Substring(0, path.LastIndexOf("\\")); path = path.Substring(0, path.LastIndexOf("\\")); db.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Database\\demos.mdb "; try { db.oleDbDataAdapter1.Update((DataSet)GridWeb1.WebWorksheets[0].DataSource); } finally { db.oleDbConnection1.Close(); }
Wish this helps.
swapna
November 5, 2007, 2:08am
5
hi,
its working fine when we add new rows. but the main problem is after deleting a row from the grid i click on save button. its giving error at the place
DataRowView rowView = (DataRowView)sheet.GetRowBindObject(row);
rowView["heading"] = sheet.Cells[row, 3].Value;
what is the problem. can you give me the solution for this.
swapna
henry
November 8, 2007, 12:14am
6
Hi,
Can you get the error message about the error?