Reputation: 105
Good day guys, I am binding asp.net gridview whose datasource table is a programatically created table which gets populated dynamically by getting data from different tables via joins, I want to edit it, how come I am going to get row index(for editing) as data is coming from different tables And has no unique identifier as it is just in memory i.e. dataset visualiser, neither hidden field nor datakeynames seems to work, any help please?
Upvotes: 2
Views: 970
Reputation: 2885
DataTable GetTableWithUniqueColumn()
{
DataTable table = new DataTable();
table = GetDataFromDB(); // dynamically getting data from different tables via joins
table.Columns.Add("UniqueColumn", typeof(Guid));
foreach (DataRow row in table.Rows)
{
row["UniqueColumn"] = Guid.NewGuid();
}
return table;
}
Upvotes: 2