怎么取不到DropDownList的值,晕了
aspx代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="rt" runat="server">
<asp:ListItem value="qq">qq</asp:ListItem>
<asp:ListItem value="ww">ww</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="ko" runat="server" />
<asp:Button ID="Button1" runat="server" Text="点点看" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
aspx.cs代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Request["ko"] != null)
{
Response.Write(Request["ko"]);
}
else
{
Response.Write(rt.SelectedItem.Value);
}
}
}
为什么就是取不到DropDownList 的值呢?