Fire JS From Code Behind onClick

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Aug 2010

    Posted 09 Sep 2010 Link to this post

    I have a RadPanelBar that when clicked, loads the proper user control / file.  It basically looks for the text value of the item clicked and "If clickedText = "value" Then ---DO SOMETHING--- End If"

    I have one tab labeled "All Products".  When clicked, I would like to load a RadWindow (aspx page).

    I am using the below code to test.... *note that even changing the window.radopen command to something simple like alert('hello') works the same.

    If e.PageView.ID = "All Products" Then
    Dim myscript As String = "window.radopen("Details.aspx?AuthorID=22", null);"
    Page.ClientScript.RegisterStartupScript(Me.GetType(), "MyScript", myscript, True
    'Response.Redirect("test-try.asp", True) 
    End If

    When ran like such, nothing happens.  No error, no action. 

    If I uncomment the Response.Redirect portion, it does redirect onClick of "All Products", so I know the action is triggering that sub.

    If I add the following code to Page_Load, I am prompted with the rad window on load.

    If Not Page.IsPostBack Then
       AddPageViewGrid("All Products")
    End If

    So it seems to work when called automatically onLoad, but not conditionally onClick.

    Any ideas?




  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2010 Link to this post

    Hello Michael,

    Here is the forum link which shows how to open the window from code behind.

    Also you can find some related topics in the following links:
    Executing JavaScript function from server-side code
    Calling radalert from codebehind

Back to Top