alexis
alexis

Reputation: 11

ASP.Net chat application javascript pop-up window

I am designing an ASP.Net chat application. I have an online user list which are LinkButtons in a ListView. I want to click one of them and open a pop-up window. How can I do that?

Upvotes: 1

Views: 1016

Answers (1)

Brian Beckett
Brian Beckett

Reputation: 4900

Set your LinkButtons so they have an onclick attribute that opens a popup window.

Codebehind:

Dim username as String = "foo"
lnkbtn.Attributes.Add("onClick", "javascript:openWindow(" & username & ");return false;")
'The "return false" part is important - it stops the LinkButton from doing a postback.

Client-side:

function openWindow(username) {
    window.open(my_url + username); //Where my_url is the URL that you want to open.
}

username is just there as an example of how you can pass values through to Javascript.

Upvotes: 1

Related Questions