Can you help me how can I solve this with Radgrid.
See screenshot.
Thanks!
See screenshot.
Thanks!
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 09 Nov 2010, 06:44 AM
Hello,
One suggestion to accomplish this functionality is described below.
Set custom CommandName for the ButtonColumn and attach ItemCommand event to grid. In the ItemCommand event handler, get access to GridDataItem and after checking the CommandName. Now access the cell values and add the row to DataTable which is DataSource of second grid.
After adding the items, when clicking the button, update the db according to DataTable values.
-Shinu.
One suggestion to accomplish this functionality is described below.
Set custom CommandName for the ButtonColumn and attach ItemCommand event to grid. In the ItemCommand event handler, get access to GridDataItem and after checking the CommandName. Now access the cell values and add the row to DataTable which is DataSource of second grid.
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
Response.Write(
"fired"
);
if
(e.CommandName ==
"addItems"
)
{
GridDataItem item = (GridDataItem)e.Item;
string
value1 = item[
"ColumnUniqueName1"
].Text;
string
value2 = item[
"ColumnUniqueName2"
].Text;
// Create new row and add to DataTable
}
}
After adding the items, when clicking the button, update the db according to DataTable values.
protected
void
RadGrid2_NeedDataSource(
object
source, GridNeedDataSourceEventArgs e)
{
RadGrid2.DataSource = dt;
}
-Shinu.
0
ken
Top achievements
Rank 1
answered on 09 Nov 2010, 09:09 AM
If you add one row , it ok.
But add second row, it reload page , so datatable now have only the second row.
Have any idea!
Thanks so much!
But add second row, it reload page , so datatable now have only the second row.
Have any idea!
Thanks so much!
0
ken
Top achievements
Rank 1
answered on 10 Nov 2010, 06:03 AM
Help please!
0
Shinu
Top achievements
Rank 2
answered on 10 Nov 2010, 07:39 AM
Hello,
On option is saving the DataTable in a session variable so that all the data will be available when binding the second grid. In the NeedDataSource event, get the DataTable from session and set as DataSource.
You can find a sample code here in this forum. Can RadGrid show temporary values
-Shinu.
On option is saving the DataTable in a session variable so that all the data will be available when binding the second grid. In the NeedDataSource event, get the DataTable from session and set as DataSource.
You can find a sample code here in this forum. Can RadGrid show temporary values
-Shinu.