Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
280 views

Hi

I am following the following example to display an aspx page in popup radwindow.

http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx

My code to display radwindow is given below at the end and is the equivalent of Dialog1.aspx in the above example. The code works fine and the content of the below aspx page opens fine in radwindow. Problem is when I click on the ‘I Accept’ button to close the radwindow and return the values to calling page (not included here) the radwindow closes but then reappears immediately. In other words the radwindow cannot be closed permanently using the ‘I Accept’ button. What is the problem and how can I make it work like the example in above link where pressing Submit button in dialog1.aspx closes the radwindow and returns values to calling form?

Many Thanks

Regards

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
  
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewDocument.aspx.cs" Inherits="SitefinityWebApp.Widgets.TestWidgets.ViewDocument" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body style="margin: 0px" onload="AdjustRadWidow();">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" DecoratedControls="All" runat="server"
        Skin="Sunset" />
    <script type="text/javascript">
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
  
        function openWin2() {
            var parentPage = GetRadWindow().BrowserWindow;
            var parentRadWindowManager = parentPage.GetRadWindowManager();
            var oWnd2 = parentRadWindowManager.open("Dialog2.aspx", "RadWindow2");
            window.setTimeout(function () {
                oWnd2.setActive(true);
            }, 0);
        }
  
        function populateCityName(arg) {
            var cityName = document.getElementById("cityName");
            cityName.value = arg;
        }
  
        function AdjustRadWidow() {
            var oWindow = GetRadWindow();
            setTimeout(function () { oWindow.autoSize(true); if ($telerik.isChrome || $telerik.isSafari) ChromeSafariFix(oWindow); }, 500);
        }
  
        //fix for Chrome/Safari due to absolute positioned popup not counted as part of the content page layout
        function ChromeSafariFix(oWindow) {
            var iframe = oWindow.get_contentFrame();
            var body = iframe.contentWindow.document.body;
  
            setTimeout(function () {
                var height = body.scrollHeight;
                var width = body.scrollWidth;
  
                var iframeBounds = $telerik.getBounds(iframe);
                var heightDelta = height - iframeBounds.height;
                var widthDelta = width - iframeBounds.width;
  
                if (heightDelta > 0) oWindow.set_height(oWindow.get_height() + heightDelta);
                if (widthDelta > 0) oWindow.set_width(oWindow.get_width() + widthDelta);
                oWindow.center();
  
            }, 310);
        }
  
        function returnToParent() {
            //create the argument that will be returned to the parent page
            var oArg = new Object();
  
  
            oArg.cityName = "London";
  
            oArg.selDate = toLocaleString();
  
            //get a reference to the current RadWindow
            var oWnd = GetRadWindow();
  
            //Close the RadWindow and send the argument to the parent page
            if (oArg.selDate && oArg.cityName) {
                oWnd.close(oArg);
            }
            else {
                alert("Please fill both fields");
            }
        }
    </script>
    <div>
        <asp:Panel ID="Panel1" runat="server" Height="100%" Width="100%">
            <table style="width: 100%; height: 100%;">
                <tr>
                    <td colspan="3">
                           
                        <asp:Literal ID="Literal1" runat="server"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                             
                    </td>
                </tr>
                <tr>
                    <td align="center" width="40%">
                           
                    </td>
                    <td align="center" width="10%" style="width: 20%">
                        <button title="I Accept" id="close" onclick="returnToParent(); return true;">
                            I Accept</button>
                    </td>
                </tr>
  
            </table>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

Satya
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
140 views
Hi,
I use the Q3 2011 version of radcombobox (with the checkboxes) :

                        <FormTemplate>
                            <br />
                            <table>
                                <tr style="width: 100px">
                                    <td class="style44" style="font-family: Verdana; font-size: x-small;">
                                        Κωδ.Προϊοντος:
                                    </td>

                                    <td class="style29">

                                        <telerik:RadComboBox
                                            ID="RadComboBox1" runat="server" Filter="Contains" ItemsPerRequest="20" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
                                            Width="350px" Height="200px"  Font-Size="X-Small" Font-Names="verdana" EnableLoadOnDemand ="true"
                                            ShowMoreResultsBox="True"
                                           
OnItemsRequested="RadComboBox1_ItemsRequested"
                                            style="margin: 20px auto; display:block !important;" />


                                            <asp:Button ID="Button1" runat="server" Text="Get Checked Items!" CssClass="qsfButtonBigger"             commandname="Button1Action" />
                                                <br />
                                            <asp:Label ID="itemsClientSide" runat="server" BorderStyle="None" CssClass="text" />
                                    </td>
                                </tr>
                            <table />
                        </FormTemplate>  

-----------------------------------------------------------------------------------------------------------------


I fill in the radCombobox with the :

    Protected Sub RadCombobox1_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)

        Dim data As DataTable = GetData(e.Text)
        Dim comboBox As RadComboBox = DirectCast(o, RadComboBox)
        Dim row As DataRow
        comboBox.Items.Clear()

        Dim text As String = e.Text

        If text <> "" Then
            If Len(text) >= 3 Then

                Dim rows As DataRow() = data.[Select]("newprd LIKE '" + "%" + text + "%'")

                Dim itemsPerRequest As Integer = 20
                Dim itemOffset As Integer = e.NumberOfItems
                Dim endOffset As Integer = itemOffset + itemsPerRequest
                If endOffset > rows.Length Then
                    endOffset = rows.Length
                End If

                Dim i As Integer = itemOffset
                While i < endOffset
                    comboBox.Items.Add(New RadComboBoxItem(rows(i)("newprd").ToString()))
                    System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
                    i = i + 1
                End While

                For Each row In data.Rows
                    comboBox.Items.Add(New RadComboBoxItem(row("newprd").ToString()))
                Next row

                e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, rows.Length)

            End If
        End If
    End Sub

-----------------------------------------------------------------------------------------------------------------

And the data are from :

    Private Function GetData(ByVal text As String) As DataTable
        If text <> "" Then
            If Len(text) >= 3 Then
                Dim seq As String = " SELECT prdcode as prdcode,prdtext,prdcode + '  ' + prdtext as newprd,P,D,S " + _
                                    " FROM Products_Kompass " + _
                                    " where " + _
                                    " prdcode + '  ' + prdtext like '" + "%" + Trim(text) + "%" + "'" + _
                                    " order by prdcode "

                Dim adapter As New SqlDataAdapter(seq, ConfigurationManager.ConnectionStrings("P2OPubConnectionString").ConnectionString)

                Dim data As New DataTable()
                adapter.Fill(data)
                Return data
            End If
        End If
    End Function

-----------------------------------------------------------------------------------------------------------------

When I select the items from the radcombobox and push the button (button1) :

    Protected Sub radKOMPASS_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles radKOMPASS.ItemCommand

        Select Case e.CommandName

            Case "Button1Action"

                Dim cb As RadComboBox = e.Item.FindControl("RadCombobox1")
                Dim sb As New StringBuilder()
                Dim collection As IList(Of RadComboBoxItem) = cb.CheckedItems /// Here the count is zero (0) ///

                For Each item As RadComboBoxItem In Collection
                    sb.Append(item.Text + "<br />")
                Next

                Dim lb As Label = e.Item.FindControl("itemsClientSide")

                lb.Text = sb.ToString()
        End Select
    End Sub


In a few words I can't take the items which i chosen from the radcombobox. There is not any error in the code. The result is ZERO in the cb.CheckedItems.

Please,I need your help desperately. My implementation time is over.
Thanks in advance.

Kalina
Telerik team
 answered on 09 Mar 2012
1 answer
113 views
I am looking into deploying the SPRadScheduler web part, but would like to know if it is possible to display the control as a mini calendar view.  Hovering or clicking on the dates would display the schedule for that particular day. I haven't found any documentation on how to do this.  Is this possible?
Kalina
Telerik team
 answered on 09 Mar 2012
2 answers
108 views
Hi,

how can I disable calendar selection in datepicker and allow to select only a few dates added in code behind ?

Thanks.
Jarek
Top achievements
Rank 1
 answered on 09 Mar 2012
7 answers
467 views
Weird issue with editing: see reply.
Merritt
Top achievements
Rank 1
 answered on 09 Mar 2012
5 answers
126 views
Hi
I have used a radsplitter,and inside radsplitter I have used a radslidingpane.
Hierarchy is likethis :
    RadSplitter1    
    RadPane1
            RadSlidingZone1
                RadSlidingPane1
All my controls are inside the sliding pane.I have a button inisde the radsliding pane
My query is : I want to close the pane on a buttton click inside the radsliding pane.
How can I acheive this.
Please help me

Thanks,
A2H
Julie
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
505 views
Hi,

Can the radalert callback function be a method on an object?  I'm trying to use the following:

myObject.callback

as the callback paramter but it doesn't work.  I have had it working when I just reference a function.

TIA

Jeff
Marin Bratanov
Telerik team
 answered on 09 Mar 2012
3 answers
72 views
Is possible to configure TabStrip to use a print friendly layout? Any suggestions where to start digging?

Thanks,
Richard
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
252 views
hi,

I have jquery ajax function (json) to get datatable from database, now I want to assign this datatable to rad grid data source,
so any help how to do that?

Richard
Top achievements
Rank 1
 answered on 09 Mar 2012
4 answers
133 views
Is there a way to turn off the initial Save/Cancel/Options popup and go striaght to the Advanced Form when creating a new appointment? We require several fields to create an appointment and all that little popup takes is a subject.

Thanks!
Sam
Peter
Telerik team
 answered on 09 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?