Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > RadWindow return values
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

RadWindow return values

Feed from this thread
  • dannyyy avatar

    Posted on Jun 16, 2007 (permalink)

    Hello,

    To explain my problem I'll give you a quite simple example.

    I've a RadTreeView, RadWindow and a button on a website.
    After a button click the RadWindow will open. (I use OpenerElementId)
    In the RadWindow a site is loaded with two textboxes and a button.

    After a user has entered some text in these two textboxes, the user will click the botton. Now the RadWindow should close and fire an event or postback or callback or somthing, which I can catch on server side.

    If I use the JavaScript method radclose(returnvalue), so only one paramter will get back. But I need two values. And how can I get this values on server-site? I know there is an event ClientCallbackFunction but this function allows me only to get one value on client side...but I need these values on server-side!!

    Unfortunately, has the RadWindow controll no such events. Only some unusable like init, dispose, unload, databind, ...

    I hope you will understand what I mean. I'm not a native English speaker and it's hard to write in a understandable way...

    Best regards
    Danny Meier

  • dannyyy avatar

    Posted on Jun 17, 2007 (permalink)

    I've solved this issue by myself.

    If anyone is interessted in how it works, let e message here and I will show you my example.

    Danny Meier

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 18, 2007 (permalink)

    Hello dannyyy,

    As noted in the documentation (Client-side API section), if you want to return multiple values from the dialog, you will need to create the argument as a new object and assign multiple values to it:
    var arg = new Object();
    arg.NameValue = document.getElementById("NewNameArea").value;
    arg.ProfessionValue = document.getElementById("NewProfessionArea").value;

    A working example of this approach is available in the following Code Library article: Returning multiple Values From a Dialog

    As for sending the results on the server, since the dialogs (just as the standard browser's popup) are created and handled on the client,  you will need to postback / ajax callback the arguments to the server somehow. For example you can use __doPostBack() or document.form1.submit() depending on your scenario. You can do that when the RadWindow is closed, e.g. in the OnClientClose event.



    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Kavya Master avatar

    Posted on Jul 2, 2007 (permalink)

    Hello Georgi


    I am trying to do the same thing.Trying to get updated values from RadWindow to the Parent window.
    I am trying to one value however how can i return the updated value and copy it into a lable which is in Form Template which inturn is in RadGrid.Please do let me know.
    Or can i send it to a session variable in the page load or any other method of Radgrid.

    Thanks
    Kavya

  • Sebastian Sebastian admin's avatar

    Posted on Jul 3, 2007 (permalink)

    Hi Kavya ,

    I believe that the sample projects from the following forum posts can get you started in your implementation:

    http://www.telerik.com/community/forums/thread/b311D-tekcb.aspx

    http://www.telerik.com/community/forums/thread/b311D-tkdga.aspx

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Kavya Master avatar

    Posted on Jul 3, 2007 (permalink)

    Hello Stephen

    I still doesn' work

    I am attaching my Javascript code and itemDatabound .Please check it and let me know where i am doing wrong.

    JavaScript Functions

    function ShowUpdatedWindows(string)  
             {  
               
                  window.radopen("UpdatePatientDetails_Dialog.aspx?updated_string=" + string, "UserListDialog");  
                    return true;   
                    }  
     
    function CallBackFunction(radWindow, returnValue)  
                    {  
            //Instead of Text1 its a label control in FormTemplate of Radgrid  
                    var oArea = document.getElementById("text1");  
                    alert(oArea)  
                      
                        if (returnValue) oArea.value = returnValue;  
                      
                        else alert ("No text was returned");  
                          
                      
                      
                    } 


    Below is my RadGrid with FormTemplate
     <radG:RadGrid width="91%" Font-Size="9"  ID="RadGrid1" runat="server" EnableAJAX="True" EnableAJAXLoadingTemplate="True" Skin="WebBlue" 
                OnNeedDataSource="RadGrid1_NeedDataSource"  LoadingTemplateTransparency="10" AllowPaging="True" AllowSorting="True" GridLines="None" > 
                <PagerStyle Mode="NextPrevAndNumeric"  /> 
              
                 
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="FileNum" Width="100%">   
                  
                    <Columns>                    
                        <radG:GridBoundColumn UniqueName="Patientname" SortExpression="Patientname"   HeaderText="Patient Name" DataField="Patientname" > 
                        </radG:GridBoundColumn> 
    <radG:GridBoundColumn DataField="FileNum" DataType="System.Decimal" HeaderText="FileNum" 
                            SortExpression="FileNum" UniqueName="FileNum" Visible="False">  
                        </radG:GridBoundColumn> 
                        <radG:GridBoundColumn DataField="FileName" HeaderText="FileName" 
                            SortExpression="FileName" UniqueName="FileName" Visible="False" > 
                        </radG:GridBoundColumn> 
    <radG:GridEditCommandColumn> 
                        </radG:GridEditCommandColumn> 
                        <radg:GridTemplateColumn UniqueName="buttonclick" Groupable="False">  
                                            <HeaderStyle Width="56px"></HeaderStyle> 
                                            <ItemStyle HorizontalAlign="Center"></ItemStyle> 
                                            <ItemTemplate> 
                                            <asp:HyperLink ID="hyperlink1" runat="server" Text="OpReport" /> 
                                                </ItemTemplate> 
                                        </radg:GridTemplateColumn> 
                    
                          
                    </Columns> 
     <EditFormSettings EditFormType="Template">  
                        <EditColumn UniqueName="EditCommandColumn1">  
                        </EditColumn> 
                        <FormTemplate> 
                            <table id="Table2" cellspacing="2" cellpadding="1" width="250" border="1" rules="none" 
                                style="border-collapse: collapse">  
                                <tr class="EditFormHeader">  
                                    <td colspan="2">  
                                        <b>Patient Details</b></td>  
                                </tr><tr>  
                 <td style="width: 1000px">  
                <table id="Table1" cellspacing="1" cellpadding="1" border="0" class="module" style="width: 900px; height: 195px;">  
                          <tr><td style="width: 900px"></td><td></td> 
                            <td style="width: 300px"><h5> 
                                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Please Review</h5></td>  
                            <td style="width: 140px"</td> 
                            </tr>         
                        <tr><td style="width: 900px">Patient Name </td><td><asp:Label ID="patient_lbl" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.PatientName") %>' Width="237px"></asp:Label><asp:HyperLink id="pt_link" runat="server"></asp:HyperLink></td>  
                            <td style="width: 300px"><asp:TextBox id="ptname_txt"  runat="server" Width="244px" ></asp:TextBox><br /></td>  
                            <td style="width: 140px">  
                                &nbsp;</td> 
                            </tr> 
    <tr><td>

    <asp:Label ID="filenum_lbl" Visible="false" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.filenum") %>' Width="280px"></asp:Label><asp:Label ID="proc_num_lbl" Visible="false" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.procedurenum") %>' Width="280px"></asp:Label><asp:Label ID="file_name_lbl" Visible="false" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.filename") %>' Width="280px"></asp:Label><asp:Label ID="filestatus_lbl" Visible="false" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.filestatus") %>' Width="280px"></asp:Label></td></tr>

    <asp:Button ID="affirm_btn" runat="server" CommandName="Affirm" Text="Affirm All" OnClick="Affirm_all" /></td><td>&nbsp;&nbsp;&nbsp;            <asp:button id="btnCancel" text="Cancel" runat="server" causesvalidation="False" commandname="Cancel"></asp:button></td>  
     </td></tr>  
                    </table></td></tr></table>  
                            </FormTemplate> 
                                </EditFormSettings> 
     
                    <ExpandCollapseColumn Visible="False">  
                        <HeaderStyle Width="19px" /> 
                    </ExpandCollapseColumn> 
                    <RowIndicatorColumn Visible="False">  
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                </MasterTableView> 
                 
                            
               <ItemStyle Width="100px" /> 
            </radG:RadGrid> 
            <radw:RadWindowManager ID="RadWindowManager1" runat="server" ClientCallBackFunction="CallBackFunction" > 
                    <Windows> 
                        <radw:RadWindow ID="UserListDialog" runat="server" Title="User List Dialog" Height="400px" 
                            Width="600px" Left="650px" ReloadOnShow="true" Modal="true" /> 
                    </Windows> 
                </radw:RadWindowManager> 
                  
     
                &nbsp; &nbsp;  
                <br /></center>  
                <asp:TextBox ID="text1" runat="server" Height="1px" Width="1px" ></asp:TextBox> 


    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
            Try  
     
                Dim cds As New CommonClass  
                Dim filenumber, file_name As String  
                Dim procedure_number As Integer  
                If TypeOf (e.Item) Is GridEditFormItem And e.Item.IsInEditMode = True Then  
                    'If (e.Item.OwnerTableView.IsItemInserted) Then  
                    For Each item As GridItem In RadGrid1.MasterTableView.Items  
     
                        Dim grdEItem As GridEditFormItem = CType(e.Item, GridEditFormItem)  
                        Dim filenum As Label = grdEItem.FindControl("filenum_lbl")  
                        Dim proc_num As Label = grdEItem.FindControl("proc_num_lbl")  
                        Dim selected_filename As Label = grdEItem.FindControl("file_name_lbl")  
     
                       
     
                        'patient_Name  
                        Dim ptname As Label = grdEItem.FindControl("patient_lbl")  
                        Dim ptname_lnk As HyperLink = grdEItem.FindControl("pt_link")  
                        If (ptname.Text = "") Then  
                            ptname.Text = "<font color='Red'>No Patient Name</font>" 
                        Else  
                            ptnameptname_lnk.Text = ptname.Text  
                            ptname_lnk.Attributes("href") = "#"  
     
                            ptname_lnk.Attributes("onclick") = " return ShowUpdatedWindows('" + ptname_lnk.Text + "');"  
                              
                            'String.Format("return ShowUpdatedWindows('{0}','" & ptname_lnk.Text & ptname.ClientID "');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("EmployeeID"))  
                            ' RadGrid1.Controls.Add(New LiteralControl("<script type='text/javascript'>window['combo ID'] = '" + ptname.ClientID + "';</script>"))  
                        End If  
     Next  
                    'End If  
     
                ElseIf TypeOf (e.Item) Is GridDataItem Then  
     
                    Dim item As GridDataItem = e.Item  
     
                    filenumber = item("filenum").Text  
                    file_name = item("filename").Text  
                    If (item("procedurenum").Text = "&nbsp;") Then  
                        procedure_number = 0 
                    Else  
                        procedure_number = item("procedurenum").Text  
                    End If  
     
                    Session("filename") = file_name  
                    Session("filenum") = filenumber  
                    ' Session("procedure_num") = procedure_number  
                    Dim lnk As HyperLink = item.FindControl("HyperLink1")  
                    lnk.Attributes("href") = "#"  
                    lnk.Attributes("onclick") = String.Format("return ShowEditForm('','" + filenumber + "','" + file_name.Replace("\", "\\") + "');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("EmployeeID"))  
     
                    ' lnk.NavigateUrl = "~/Show_OpReport.aspx?filenum=" + filenum  
                    'lnk.Target = "_Top" 
     
                End If  
     
            Catch ex As Exception  
                Throw New Exception("Affirm_OpReports.RadGrid1_ItemDataBound() -- " & ex.Message)  
            End Try  
        End Sub 


    Please do let me know its kind of urgent.

  • Kavya Master avatar

    Posted on Jul 3, 2007 (permalink)

    Hello Stephen

    Atleast i am getting the ID for the textbox or the label how ever not able to set the value for that textbox after updated from the RadWindow.

  • Sebastian Sebastian admin's avatar

    Posted on Jul 5, 2007 (permalink)

    Hello Kavya ,

    I went through your code and noticed that you perform loop through all grid items inside the ItemDataBound handler. What is the purpose of this cycle? I have not found any usage of the item variable inside the loop.

    Moreover, note that not all grid items will be available on ItemDataBound as some of the rows will not yet be bound to data there. Nevertheless the ItemDataBound event should be raised for each grid row on the current page.

    Review once again the sample project from the first linked forum thread in my previous reply to familiarize with the code logic in it and inject it in your project configuration.

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Kavya Master avatar

    Posted on Jul 5, 2007 (permalink)

    Hello Stephen

    Your are great not sure why i didn't think about it .Just removed that For Loop and it worked perfectly.I remember seeing a code with that Loop and  i was trying to do the same .If i still get any issues i will mail you back.


    Thanks
    Kavya

  • Steve avatar

    Posted on Jun 6, 2011 (permalink)

    The links above don't work. Can someone please update them.  Thanks.

    http://www.telerik.com/server-error.aspx?aspxerrorpath=/community/code-library/preview-thread/aspnet-ajax/window/returning-multiple-values-from-a-dialog.aspx

    http://www.telerik.com/server-error.aspx?aspxerrorpath=/community/code-library/subforums-list/default.aspx

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 6, 2011 (permalink)

    Hello Steve,

    The post is quite old (4 years now) and this code library does not exist anymore. You can check our Returning values from a dialog demo that uses the same logic that was shown in the CL.

    Regards,
    Georgi Tunev
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > RadWindow return values