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

Sending radgrid selected values from radwindow to parent

5 Answers 114 Views
Window
This is a migrated thread and some comments may be shown as answers.
Claude
Top achievements
Rank 1
Claude asked on 20 Oct 2010, 05:23 PM
Greetings,

Im trying to send multiple selected values from a radgrid, which is on a radwindow (acting as a dialogue). I can successfully send values that are in textboxes and comboboxes but the problem is when the code reaches a point where its supposed to send values from the radgrid. I get the NULL OBJECT ERROR. I have tried using Sys.application.add_load to noavail.

This is the function that im using to retrieve the selected values on the radgrid.
function returnToParent() {
             
               //create the argument that will be returned to the parent page
               var oArg = new Object();
               //THE NULL OBJECT ERROR IS ON THIS LINE
               var gridView = $find("<%= RdGRoles.ClientID %>").get_masterTableView();
                               
               oArg.selGroup = gridView.get_selectedItems();
               //get a reference to the current RadWindow
               var oWnd = GetRadWindow();
               oWnd.close(oArg);
               
           }

Im calling this function when a user clicks OK button:

Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOk.Click
       ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "returnToParent();", True)
   End Sub

Thanks in advance

5 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 20 Oct 2010, 06:24 PM
Hello Claude,

I'm assuming that the content inside your RadWindow is from another page, meaning your not using the ContentTemplate. If so, I think you need to change your returnToParent method to something like this:

function returnToParent() { 
             //get a reference to the current RadWindow 
               var oWnd = GetRadWindow(); 
  
               //create the argument that will be returned to the parent page 
               var oArg = new Object(); 
               //THE NULL OBJECT ERROR IS ON THIS LINE 
               var gridView = $find("<%= RdGRoles.ClientID %>",oWnd.BrowserWindow).get_masterTableView(); 
                                 
               oArg.selGroup = gridView.get_selectedItems(); 
                 
               oWnd.close(oArg); 
                 
           }

It uses the optional parameter of the $find method to search for the grid in the parent window. Before it was looking inside of the RadWindow, where the control doesn't exist.

I hope that helps.

0
Claude
Top achievements
Rank 1
answered on 21 Oct 2010, 09:15 AM
Hello Cori,

Thanks for the prompt reply. The radgrid is on the radwindow and im generating its data from the radwindow. All I need to do is transfer its selected values to another radgrid which is on the parent page. I do manage with other controls but the radgrid is giving the 'NULL' error. More like its not yet created.

Regards,
Claude
0
Cori
Top achievements
Rank 2
answered on 21 Oct 2010, 01:10 PM
Alright, in that case have you tried writing it like this:

Sys.Application.add_load(returnToParent);

I know you wrote in your first post that you tried this, but I noticed you wrote Application in all lowercase letters.

Let me know if that works.
0
Claude
Top achievements
Rank 1
answered on 21 Oct 2010, 01:32 PM
Hie Cori

The Sys.Application.add_load(returnToParent); does find the control but the radwindow loads and closes because of the oWnd.close(oArg). I dont understand why it cant find only the radgrid but can access the other controls. I can send a sample project

Thanks in advance

regards
Claudius
0
Georgi Tunev
Telerik team
answered on 22 Oct 2010, 12:37 PM
Hello Claudius,

Please open a support ticket and send us the sample project so we can examine in more details your exact setup.

Sincerely yours,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Claude
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Claude
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or