Thanx guys for your help !!
Sorry, there was a typo error - I am using <asp:linkbutton
id=lbShowPopUpand NOT hyperlink.
When clicking on it, the vb.net code executed is below :
Private Sub lbShowPopUp_Click(...)
sMsgStr as string = "Some damn string with hyperlinks and many
formatting etc"
Page.RegisterStartupScript("newWin", popUpWindow(sMsgStr)
End Sub
popUpWindow(message) is in the code-behind, which does specific
formating of the page...
Jester98x, I am using <a onclick="popUpWindow('Some msg here')in some
cases in the same page. But the case in which I am using
<asp:linkbutton>, its a long string and also fetches some values from
config file (passing configs value to code behind, I havent used it),
so to avoid messing up code-behind, I am using vb.net code. I am open
to other suggestions too, if its possible in my scenario.
<asp:linkbutton id=lbShowPopUpwhen clicked, these are steps that are
executed:
1page_load
2) Private Sub lbShowPopUp_Click(...)
So the page refreshes. This is unlike <awhich doesnt refresh page.
Cowboy, didnt you encounter this problem ? You said u used something
similiar which dint refresh the page, was it -
attribues.add("onClick")... or something similar to lbShowPopUp_Click
()?
Thanks again!!
Chris
Jester98x wrote:
Christina wrote:
Hello !!
Hi
I want a link on my vb.net web application, which when clicked, popUp's
up and shows a msg.
AFAIK, Javascript is the best way to go.
Yep, javascript is about as good as it gets
So I created an asp:hyperlink, and on its 'on click' event, I have
something like:
Is there a reason for using asp:hyperlink rather than a simple HTML <a
href? i.e. is the link dynamically generated from code?
If memory servers me I think you can use onclientclick to call a
javascript function to poupup the window. e.g. onclientclick="return
showAPopUp(messageString);" and have showAPopUp return false to prevent
even bubbling. This would also prevent the back button causing the
window to reappear as it is managed client side and not by the server.
Page.RegisterStartupScript("myWinName", showAPopUp(messageString),
where, showAPopUp is a code-behind function which has
window.Open(....). messageString is a string that I am building when
the click event occurs.
I have 2 problems :
1) When the 'on Click' event fires, it posts back the page (I beleive,
its posting it to the server). But I am trying to use client sides
scripting to avoid server posts. Does Page.RegisterStartupScript post
data to the server ? If yes, is there a way I can do this without
posting it to the server ?
As mentioned above try not to use asp:hyperlink unless there is a
reason to do so, if you do use the onclientclick option rather than
onclick.
2) In the same link mentioned above, this is the sequence i am
following, which creates a problem.
i click the hyperlink, it opens a pop-up, i close it, go to next page.
Now, when I click IE's back button, instead of showing just the
previous page, it shows me the popup first. Is there a way I can avoid
this too ?
Using the above mentioned method should fix this.
Thanks !!
Your welcome.
Steve