📄 demo-arrayindexof.aspx
字号:
<%@ Page Language="C#" Debug="true" %>
<script runat="server">
void Page_Load()
{
if (Page.IsPostBack)
{
string[] VendorShipping = new string[3];
VendorShipping[0] = "no shipping";
VendorShipping[1] = "Canada Post";
VendorShipping[2] = "UPS";
lblShipper.Text = "Shipper ID for " + txtShipNum.Text + " is " + Array.IndexOf(VendorShipping, txtShipNum.Text);
// lblShipper.Text = "Shipper ID for ";
lblShipper.Visible = true;
} //End if (Page.IsPostBack)
} // End Page_Load
</script>
<html>
<head>
<title>Array Example</title>
</head>
<body>
<form runat="server">
Please enter your shipper name.
(should be "no shipping" or "Canada Post" or "UPS")
<br><asp:TextBox id="txtShipNum" runat="server" width="300px"></asp:TextBox>
<br />
Press button to find the Shipper ID number
<asp:Button id="Button1" runat="server" Text="Submit"></asp:Button>
<br />
<asp:Label id="lblShipper" runat="server"></asp:Label>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -