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

[Solved] results of one grid posted to another

3 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sammy
Top achievements
Rank 1
Sammy asked on 07 Feb 2013, 10:24 PM
My search is failing me, so I apologize if I've missed this.

What I have is a Grid, with multiple rows, and each row has has various checkboxes, textboxes, and dropdowns in it. The user selects various options and enters data.
(think of an advanced search option screen)

I have this grid working correctly.

They then click a submit button.

I would like to make an ajax request to populate a 2nd grid, right below the 1st grid, so they can see there results.

This 'seems' like it should be easy to do, but I just can't put it together.

Can someone point me in the right direction to a tutorial?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Feb 2013, 11:48 AM
Hi,

Try the following code to achieve your scenario.
aspx:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
  <AjaxSettings>
       <telerik:AjaxSetting  AjaxControlID="Button2">
            <UpdatedControls>
               <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
            </UpdatedControls>
       </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="true" OnNeedDataSource="RadGrid2_NeedDataSource"></telerik:RadGrid>
C#:
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
        if (e.Argument == "select")
        {
          RadGrid2.Rebind();
        }
 }

Thanks,
Shinu
0
Sammy
Top achievements
Rank 1
answered on 08 Feb 2013, 03:38 PM
Ok, I think I got this working. Thanks for the nudge. It pushed me in the right direction.

You definitely saved me a bunch of time.

off to do some more testing.

However, it doesn't look like RadAjaxManager1_AjaxRequest actually fires (I set a breakpoint in that method, and nothing happens.

What does that method do?
0
Shinu
Top achievements
Rank 2
answered on 11 Feb 2013, 07:11 AM
Hi,

You can pass the CommandArgument and fire the server side event as shown below.
JS:
function OnClientClick() {
      var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("select");
  }
C#:
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
 {
        if (e.Argument == "select")
        {
            RadGrid2.Rebind();
        }
 }

Thanks,
Shinu
Tags
Grid
Asked by
Sammy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sammy
Top achievements
Rank 1
Share this question
or