2 questions about response.redirect, ClientScript.Register and postbackUrl

T

Tony

Hi,

I have two questions:

1) With this code, i never see the alert message. Why? How to see it?

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "myscript", _
" alert('you go to stating page.');", True)
response.redirect("start.aspx", false)

2) with this code, when clicking on button1, nothing happens. Why and how to
solve that?

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "myscript", _
" alert('you go to stating page.');" & _
" window.location.href='start.aspx';", True)

<asp:Button ID="Button1" runat="server" Text="click"
PostBackUrl="~/start.aspx" />

Thanks
Tony
 
T

Tony

Sorry, the second question contained a little error: here the new version:

1) With this code, i never see the alert message. Why? How to see it?

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "myscript", _
" alert('you go to stating page.');", True)
response.redirect("start.aspx", false)

2) with this code, when clicking on button1, instead of going to file
anywhere.aspx, nothing happens. Why and how to
solve that?

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "myscript", _
" alert('you go to stating page.');" & _
" window.location.href='start.aspx';", True)

This is into file start.aspx:
<asp:Button ID="Button1" runat="server" Text="click"
PostBackUrl="~/ANYWHERE.aspx" />

Thanks
Tony
 
E

Eric

Does that generate a standard 404 error...?
Yes
i solved it by using Sub Button1_Click
It works that way
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top