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

Free Support Forum - aspose.com

Datasource empty after paste

Hi,

I need to be able to paste 100's (unknown number) of rows and cannot paste into a grid without the rows already existing.

I have added a second grid to the page that has an empy set of a 1000 rows.

The second grid is not visible when the page loads and is made visible when the user clicks a custom button on hte first grid. In a modal fashon.

All this is fine and the grid seems to work except that when I go to copy the pasted data back into the first grid, the datasource has not changed its values to the pasted data.

The code is executed after a custom command is called on the second grid, so it should be updated in the datasource.

What could cause the datasource to be unchanged.

Also have noted that it doesn't matter if the data is pasted or entered manually the data is not in the datasource.

Also tried prepopulating the datasource to see what happens and the data is not shown in the grid.

This is my populate code.

public void Populate(CustomControls.ContractsWebGrid grid)

{

panelsVisible(true);

for (int i = GridWeb1.WebWorksheets.Count - 1; i >= 0; i--)

{

GridWeb1.WebWorksheets.RemoveAt(i);

}

WebWorksheet sourceSheet = grid.WebWorksheets[grid.ActiveSheetIndex];

WebWorksheet sheet = new WebWorksheet();

GridWeb1.WebWorksheets.Add(sheet);

DataTable data0 = new DataTable();

//Copy Columns from the source grid.

foreach (BindColumn col in sourceSheet.BindColumns)

{

data0.Columns.Add(col.Caption);

BindColumn b = new BindColumn();

b.Caption = col.Caption;

b.Width = col.Width;

sheet.BindColumns.Add(b);

}

for (int i = 0; i < 100; i++)

{

DataRow dr = data0.NewRow();

//prepopulate test

dr[0] = "TestVal1";

dr[1] = "TestVal2";

dr[2] = "TestVal3";

dr[3] = "TestVal4";

dr[4] = "TestVal5";

//Add the row

data0.Rows.Add(dr);

}

sheet.DataSource = data0;

//sheet.CreateAutoGenratedColumns();

sheet.DataBind();

//OkButton.Focus();

}

This is the code that doesn't have any data in the datasource.

void GridWeb1_CustomCommand(object sender, string command)

{

//The grid at this point has a datasource with the rows but now data.

if (ImportGrid != null) { ImportGrid(GridWeb1); }

panelsVisible(false);

}

Hi,

Could you create a sample project, zip it and post it here to show the issue, we will check it soon.

Thank you.

I have tried to create a test project but have not been able to configure the grid for the new project.

I have queried this at

<A href="</A></P> <P> </P> <P> </P>