[英]Call JavaScript On VB.NET
我怎么打電話:
$("#buttonSKU").on('click', function() {
$("#floatDiv").fadeIn();
});
在我的VB.NET代碼下,如果:
@Code
Dim db = Database.Open("Users")
Dim SS_ID = Request.QueryString("SS_ID")
Dim initial_QRY
Dim yesInsert_QRY
Dim yesSelect_QRT
Dim ctrRecord
If SS_ID <> "" then
initial_QRY = "SELECT * FROM Tbl_rsSKUSetup WHERE SKUSetup_ItemID='" & SS_ID & "'"
ctrRecord = db.Query(initial_QRY).Count
If ctrRecord = 0 Then
System.Diagnostics.Process.Start("C:\Users\ushuam00\Documents\My Web Sites\EmptySite5\_Files\skuSetupGenericData.xlsm")
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "floatDiv", True)
Else If ctrRecord > O Then
Else
End Code
你不能
如果您使用的是asp.net網絡表單,請使用asp服務器按鈕和該按鈕上的click事件。 並在按鈕事件處理程序中編寫代碼。
如果您真的想使代碼在js中執行,則應該進行ajax請求。
http://api.jquery.com/jQuery.get/您可以對頁面(URL)進行Ajax調用GET:
var ssid = 123;
$.get("mypage.aspx", { SS_ID : ssid } function( data ) {
alert( "Data Loaded: " + data );
});
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub GreetingBtn_Click(ByVal sender As Object, _
ByVal e As EventArgs)
' When the button is clicked,
' change the button text, and disable it.
Dim clickedButton As Button = sender
clickedButton.Text = "...button clicked..."
clickedButton.Enabled = False
' Display the greeting label text.
GreetingLabel.Visible = True
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Button Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h3>Simple Button Example</h3>
<asp:Button id="Button1"
Text="Click here for greeting..."
OnClick="GreetingBtn_Click"
runat="server"/>
<br />
<br />
<asp:Label ID="GreetingLabel" runat="server"
Visible="false" Text="Hello World!" />
</div>
</form>
</body>
</html
>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.