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

Passing values from RadWindow to Parent Page

1 Answer 382 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kishor
Top achievements
Rank 2
Kishor asked on 13 Jun 2013, 02:47 PM
hi,
I have a rad window which opens on button click. It has many text boxes.
I want to pass text boxes value to its parent page.
I wrote this code in popup

 function returnToParent() 
                  {
                                     
                    var oArg = new Object();
                     oArg.txtRateType=document .getElementById ("txtRateType").value;
                
                   
                    oArg.txtLabourWeekdayTotal=document .getElementById ("txtLabourWeekdayTotal").value;
                    oArg.txtLabourSaturdayTotal=document .getElementById ("txtLabourSaturdayTotal").value;
                  var oWnd = GetRadWindow();
 oWnd.close(oArg);
}
I m calling this funtion on submit button of this form.

Then on parent page,i have defined

<telerik:RadWindowManager ID="RadWindowManagerServiceReportDetails" runat="server" OnClientPageLoad="OnClientPageLoad"  Font-Names="Arial, Helvetica, sans-serif">
            <Windows >
                 <telerik:RadWindow ID="UserListDialogInvoiceWorksheet" runat="server"  Height="740px" 
                   Width="910px" ReloadOnShow="true" ShowContentDuringLoad="false" OnClientClose="OnClientCloseInvoicePopup" 
                   Modal="true" KeepInScreenBounds="true" Behaviors="Close,Move"  Font-Names="Arial, Helvetica, sans-serif" Font-Size="11 px" />
            </Windows>
    </telerik:RadWindowManager>

so when radwindow closes,this function gets called





  function OnClientCloseInvoicePopup(oWnd, args)
 {
             
               var arg = args.get_argument();
            
               if (arg) 
{
var  textBox = $find("<%=txtExitReportInvStandardDays.ClientID %>");
textBox.set_value(arg.txtLabourWeekdayTotal); 

var  textBox1 = $find("<%=txtExitReportInvPremiumDays.ClientID %>");
textBox1.set_value(arg.txtLabourSaturdayTotal)); 

}
}

but when if textbox is equal to null. and an error occurs 'null is null or not an object'.

please help me this problme.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jun 2013, 06:11 AM
Hi,

I have tried to pass the value to the parent page and it worked as expected on my end. Here is the code.
JS:
function OnClientClick()
 {
        var oWnd = $find("<%=RadWindow1.ClientID%>");
        var txt1 = document.getElementById("RadWindow1_C_txt1") //textbox inside radwindow
        var txt2 = document.getElementById("RadWindow1_C_txt2")
        var oArg = new Object();
        oArg.txtRateType = txt1.value;
        oArg.txtLabourWeekdayTotal = txt2.value;
        oWnd.close(oArg);
        return false;
 }
function OnClientCloseInvoicePopup(sender, args)
 {
        var TextBox1 = document.getElementById("TextBox1") //parent page control
        var TextBox2 = document.getElementById("TextBox2")
        var arg = args.get_argument();
        if (arg != null)
         {
          TextBox1.value = arg.txtRateType;
          TextBox2.value = arg.txtLabourWeekdayTotal;
         }
 }

Hope this will help you.
Thanks,
Shinu.
Tags
General Discussions
Asked by
Kishor
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or