[英]How to open aspx web pages on a pop up window
在點擊另一個.ASPX網頁上的LinkButton后,我正在嘗試編寫一個代碼來打開.aspx(彈出窗口的形狀)(使用VB)
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
'What code?
End Sub
不知道怎么做,我找不到彈出控件或類似的東西。
您可以使用ClientScript.RegisterStartupScript
在C#中
protected void Button1_Click(object sender, EventArgs e)
{
string queryString = "test.aspx" ;
string newWin ="window.open('" + queryString + "');";
ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true);
}
在VB中
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim queryString As String = "test.aspx"
Dim newWin As String = "window.open('" & queryString & "');"
ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)
End Sub
使用jQuery在ASP.NET中的模態彈出窗口中打開網頁或Web表單很容易:
$(function () {
modalPosition();
$(window).resize(function () {
modalPosition();
});
$('.openModal').click(function (e) {
$('.modal, .modal-backdrop').fadeIn('fast');
e.preventDefault();
});
$('.close-modal').click(function (e) {
$('.modal, .modal-backdrop').fadeOut('fast');
});
});
function modalPosition() {
var width = $('.modal').width();
var pageWidth = $(window).width();
var x = (pageWidth / 2) - (width / 2);
$('.modal').css({ left: x + "px" });
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.