开发者

ASP.Net chat application javascript pop-up window

开发者 https://www.devze.com 2023-03-22 16:14 出处:网络
I am designing an ASP.Net cha开发者_开发技巧t 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?Set your

I am designing an ASP.Net cha开发者_开发技巧t 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消