0%

ASP

简单登录程序

跳转:

1
Response.Redirect("URL")

返回弹窗

1
Response.Write("<script>alter('用户名或密码错误');</script>")

文本框的使用

text默认为单行模式

1
2
3
4
5
6
7
8
9
10
11
<p>单行模式</p>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<p>密码模式</p>
<br />
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<br />
<p>多行模式</p>
<br />
<asp:TextBox ID="TextBox3" runat="server" TextMode="MultiLine"></asp:TextBox>

image-20211209221532497

属性栏修改。

判断单选框

单选框将GroupName设置为一样即可

1
2
3
4
5
6
<label>性别</label>
<asp:RadioButton ID="RadioButton1" runat="server" Text="男" GroupName="sex"/>
&nbsp;&nbsp
<asp:RadioButton ID="RadioButton2" runat="server" Text="女" GroupName="sex"/>
<br />
<asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click2" />
1
2
3
4
5
6
7
8
9
10
11
protected void Button1_Click2(object sender, EventArgs e)
{
if (RadioButton1.Checked == true)
{
Response.Write("<script>alert('性别为男');</script>");
}
if (RadioButton2.Checked == true)
{
Response.Write("<script>alert('性别为女');</script>");
}
}

判断多选框

1
“+string+”

下拉框

1
2
3
4
5
6
7
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>原平</asp:ListItem>
<asp:ListItem>忻州</asp:ListItem>
<asp:ListItem>五台</asp:ListItem>
<asp:ListItem>定襄</asp:ListItem>
<asp:ListItem>五寨</asp:ListItem>
</asp:DropDownList>
1
2
3
DropDownList1.SelectedItem.Value
DropDownList1.SelectedValue

呈现信息

构造一个用于盛放HTML代码的变量,用Response.Write(HTML),可先用Response.Clear()清理当前页面

转换

Convert.ToDouble()

捕获异常

1
2
3
4
5
6
7
try{

}
catch(Exception es)
{

}

显示数据

image-20211210120304445

1
inf.InnerHtml=HTML;

读取全部数据

1
foreach

连接数据库

image-20211210135917242

image-20211210135930367

初始

1
2
3
4
5
6
7
8
9
</system.web>
<system.webServer>
<defaultDocument>
<files>
<clear/>
<add value="index.aspk"/>
</files>
</defaultDocument>
</system.webServer>

显示表

image-20211210175458347

拆包

image-20211210184423626

image-20211210184758134

image-20211210185030345

image-20211210185043844

image-20211210190952668

image-20211210191832719

image-20211210191935390

image-20211211204121826

image-20211211204221557

image-20211211204301439