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

Open RADWindow after PostBack

2 Answers 337 Views
Window
This is a migrated thread and some comments may be shown as answers.
Gourangi
Top achievements
Rank 1
Gourangi asked on 10 Mar 2009, 08:40 AM
Hi,

I wanted to open a radwindow after my button is clicked based on certain condition from server side.
For that I have written

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        'Me.ClientScript.RegisterStartupScript(Me.GetType, "startup", "radopen('google.com');", True)
        Me.ClientScript.RegisterClientScriptBlock(Me.GetType, "startup", "radopen('google.com');", True)
    End Sub

It is throwing me a javascript error undefined !
Neither RegisterStartupScript nor RegisterClientScriptBlock is working !

after that I have opened my radwindow after 1000 milisecond and it is working fine
means I have written

    <script type="text/javascript">
        function showMatrixWindow()
        {
            radopen('http://google.com');
        }
    </script>

on my aspx page and written

        Me.ClientScript.RegisterStartupScript(Me.GetType, "startup", "setTimeout(showMatrixWindow,1000);"
, True)

Things working fine now but why should I wait my client for even 1second.

I have even tried to bind radopen function when my document is in ready state but there it is also throwing error !

Help me out !

Thanks
Divyesh Chapaneri

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Mar 2009, 05:53 AM
Hi Divyesh,

Can you try the following code snippet for displaying window from server side buttonclick event.

VB:
Protected  Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs)  
    Dim script As String =  "<script language='javascript' type='text/javascript'>Sys.Application.add_load(showMatrixWindow);</script>"   
    ClientScript.RegisterStartupScript(Me.GetType(), "showMatrixWindow", script)  
End Sub 

Note: Include the JavaScript in <head> tag of the page.
JavaScript:
<script type="text/javascript">  
function showMatrixWindow()  
{  
    radopen('http://google.com');  
}  
</script> 

You can also try another approach to open window from code behind. See the example below;
VB:
Protected  Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs)  
    Dim NewWindow As Telerik.Web.UI.RadWindow =  New Telerik.Web.UI.RadWindow()   
    NewWindow.NavigateUrl = "http://www.google.com" 
    form1.Controls.Add(NewWindow)  
    NewWindow.VisibleOnPageLoad = True 
End Sub 
Setting Server-Side Properties

Thanks,
Princy.
0
Fiko
Telerik team
answered on 11 Mar 2009, 08:19 AM
Hi Divyesh,

You can also try one of the approaches described in this KB article.

Sincerely yours,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
Gourangi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Fiko
Telerik team
Share this question
or