This is a migrated thread and some comments may be shown as answers.

radgrid cart & catalog client

4 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ken
Top achievements
Rank 1
ken asked on 09 Nov 2010, 03:28 AM
Can you help me how can I solve this with Radgrid.
See screenshot.
Thanks!

4 Answers, 1 is accepted

Sort by
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.
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!
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.
Tags
Grid
Asked by
ken
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
ken
Top achievements
Rank 1
Share this question
or