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

Fire JS From Code Behind onClick

1 Answer 74 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 09 Sep 2010, 10:36 PM

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?

Thanks!

 

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Sep 2010, 09:10 AM
Hello Michael,


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

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


-Shinu.
Tags
PanelBar
Asked by
Michael
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or