
asp.net 4.5 练习~test5-2
发布日期:2021-05-06 21:15:34
浏览次数:15
分类:原创文章
本文共 1976 字,大约阅读时间需要 6 分钟。
webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test5_2.WebForm1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="密码提示问题:"></asp:Label> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Width="240px"> <asp:ListItem Value="0">请任选一项</asp:ListItem> <asp:ListItem Value="1">我的出生地</asp:ListItem> <asp:ListItem Value="2">我母亲的名字</asp:ListItem> <asp:ListItem Value="3">我父亲的名字</asp:ListItem> </asp:DropDownList> <br /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" Width="99px"></asp:TextBox> </div> </form></body></html>
webform1.aspx.cs
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace test5_2{ public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label2.Text = "答案:"; } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { switch (DropDownList1.SelectedValue) { case "1": Label2.Text = DropDownList1.Items[DropDownList1.SelectedIndex].Text+":"; break; case "2": Label2.Text = DropDownList1.Items[DropDownList1.SelectedIndex].Text + ":"; break; case "3": Label2.Text = DropDownList1.Items[DropDownList1.SelectedIndex].Text + ":"; break; } } }}
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2025年03月20日 02时09分12秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
MySQL(四)数据库结构设计
2019-03-04
JavaScript 函数作用域
2019-03-04
2021-05-03
2019-03-04
Mybatis-plus 常用注解
2019-03-04
HTML基本结构
2019-03-04
图(三):拓扑排序、关键路径
2019-03-04
mybatis 如何切割字符串 查询多个值
2019-03-04
算法初步 (排序, 散列, 贪心, 二分, two pointers)
2019-03-04
Python学习-基础(五)
2019-03-04
myqsl下载安装
2019-03-04
Tomcat下载安装
2019-03-04
4.10 访问权限
2019-03-04
9.5 正则表达式及字符串的替换与分解
2019-03-04
发布npm
2019-03-04
前端搜索
2019-03-04
在所有情况下取到顶层对象
2019-03-04
解构赋值
2019-03-04
封装vue的弹窗组件
2019-03-04
qt Event
2019-03-04