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

Passing search value from one grid to another

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Royal
Top achievements
Rank 1
Royal asked on 07 Mar 2011, 06:46 PM
I am looking for an efficient way to take the filtered value from one RadGrid and pass that value to another RadGrid (to update the data).

A quick search yielded no results, is this something any of you have tried before? If so, can you point me in the right direction?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Mar 2011, 05:38 AM
Hello Royal,

Check out the following code snippet which shows how to get the filtered data to pass it into another grid.

C#:
bool flag = false;
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
       if (e.CommandName == RadGrid.FilterCommandName)
        {
            flag = true;
        }
    }
      
     protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
           if (flag)
            {
                foreach (GridDataItem grdItem in RadGrid1.Items)
                {
                    int iID = Convert.ToInt32(grdItem.GetDataKeyValue("ID").ToString());//getting DataKeyValue
                   //pass the appropriate value to second grid
                    .  .   .   .
                }
                flag = false;
            }
        }

Thanks,
Princy.
0
Royal
Top achievements
Rank 1
answered on 18 Mar 2011, 06:02 PM
Princy - thanks for the reply. Based on an online example I saw on the Telerik site I went a slightly different route;

I created a function to expose filterBox.Text and then passed that into my Sproc as a parameter.
Tags
Grid
Asked by
Royal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Royal
Top achievements
Rank 1
Share this question
or