GridWeb Pasting

Hi,

I have gridweb which I allow users to enter data within it. I then loop through the rows and compare
the value in gridweb worksheet against entries contained within a separate datatable.I do this via this code:

DataRow[] result = dtPI.Select(“partCode = '” + row[“Item Number”].ToString()“’”);

This works ok if the user types the values in. If however the data is copied in, even when
its identifical the Select method on the data table fails and does not return
any results.

If you then manually type the the same value in underneath it then it works fine. Am I missing something obvious regarding the pasting of data into a gridweb control?

TIA.

Hi,


Where do you place DataTable.Select() method (i.e., your line of code) to filter data). If you are using an ASP.NET button, you need to sink events for the button’s click, see the sample line of code (in bold) below:
e.g
Sample code:

Page_Load(object sender, EventArgs e)
{
//if first visit this page clear GridWeb1
if (!IsPostBack)
{
GridWeb1.WebWorksheets.ImportExcelFile(“e:\test2\Book1.xls”);
Button1.Attributes[“onclick”] = “GridWeb1.updateData(); return GridWeb1.validateAll();”;
}
}

Thank you.

Hi,

Thanks for the suggestion, I eventually fixed it by changing the code to this:

DataRow[] result = dtPI.Select("partCode = '" + row["Item Number"].ToString() + "'");DataRow[] result = dtPI.Select("partCode = '" + row["Item Number"].ToString().Trim() + "'");<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hi Andrew,

Thanks for your feedback and using Aspose.Cells.

It is good to know that you were able to sort out this issue. Let us know if you encounter any other issue, we will be glad to look into it and help you further.