Sending radgrid selected values from radwindow to parent

6 posts, 0 answers
  1. Claude
    Claude avatar
    9 posts
    Member since:
    May 2010

    Posted 20 Oct 2010 Link to this post

    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
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 20 Oct 2010 Link to this post

    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.

  3. Claude
    Claude avatar
    9 posts
    Member since:
    May 2010

    Posted 21 Oct 2010 Link to this post

    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
  4. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 21 Oct 2010 Link to this post

    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.
  5. Claude
    Claude avatar
    9 posts
    Member since:
    May 2010

    Posted 21 Oct 2010 Link to this post

    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
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 22 Oct 2010 Link to this post

    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
Back to Top