读书人

多个DropDownList为啥不能连用

发布时间: 2013-09-28 10:01:20 作者: rapoo

多个DropDownList,为什么不能连用

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ema.aspx.cs" Inherits="ema" %>

<!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 id="Head1" runat="server">
<title>设备维护</title>
<style type="text/css">
.style3
{
width: 163px;
}
.style4
{
width: 110px;
}
.style5
{
height: 21px;
width: 110px;
}
.style7
{
width: 158px;
}
#table1
{
width: 883px;
}
.style10
{
height: 13px;
width: 178px;
}
.style11
{
width: 137px;
height: 22px;
}
.style12
{
width: 888px;
}
.style14
{
width: 318px;
height: 22px;
}
.style15
{
height: 22px;
width: 100px;
}
.style20
{
width: 238px;
}
.style21
{
width: 172px;
}
.style22
{
width: 83px;
}
.style23
{
width: 116px;
}
.style25
{
width:45px;
}
#table2
{
width: 774px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<P align="center">  </p>
<div>
<table >
<table class="border" cellSpacing="0" cellPadding="5" border="0"
style="width: 924px; height: 236px;">
<TR>


<td ><P align="center"> 通讯设备检查结果 </p></td>


</TR>
<TR>
<TD class="style12" colspan="3" align="left">

日期:<asp:TextBox ID="Ndate" runat="server"></asp:TextBox>

 地点:<asp:DropDownList ID="tb_room" runat="server" AutoPostBack="True">
<asp:ListItem>常平会议室</asp:ListItem>
<asp:ListItem>金美会议室</asp:ListItem>
<asp:ListItem>东坑会议室</asp:ListItem>
<asp:ListItem>大朗会议室</asp:ListItem>
<asp:ListItem>桥头会议室</asp:ListItem>
<asp:ListItem>培训室</asp:ListItem>
<asp:ListItem>一号会议室</asp:ListItem>
</asp:DropDownList>

</TD></TR>

<TR><TD align="left" class="style12">
<TABLE align="left" border="0"
style="width: 924px; height: 165px; margin-left: 0px;">
<TR>
<TD class="style7" colspan="1" align="right" bgcolor="#E9F0F7">电源线路是否正常:</TD>
<TD align="left" colspan="1">
<asp:DropDownList ID="L1" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>

<TD class="style3" align="right" bgcolor="#E9F0F7">交换机是否可以连网:</TD>
<TD class="style20" colspan="1">
<asp:DropDownList ID="L2" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>
</TR>
<TR>
<TD class="style7" align="right" bgcolor="#E9F0F7">网线接口是否松脱:</TD>
<TD class="style4">
<asp:DropDownList ID="L3" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>


<TD class="style3" align="right" bgcolor="#E9F0F7">网络跳线是否足够:</TD>
<TD class="style20">
<asp:DropDownList ID="L4" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >


<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>

</TR>
<tr>
<td align="right" class="style7" bgcolor="#E9F0F7">电话线路是否正常:</TD>
<TD class="style4">
<asp:DropDownList ID="L5" runat="server" AutoPostBack="True" Width="127px" Height="21px">
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>

<td align="right" class="style3" bgcolor="#E9F0F7">电话设备是否正常:</TD>
<TD class="style20">
<asp:DropDownList ID="L6" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>

</TR>
<tr>
<td align="right" class="style7" bgcolor="#E9F0F7"> 投影设备是否正常:</TD>
<TD class="style5">
<asp:DropDownList ID="L7" runat="server" AutoPostBack="True" Width="127px"
Height="21px" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList>
</TD>

<TD class="style3" align="right" bgcolor="#E9F0F7">工作桌面是否整洁:</TD>
<TD class="style20">
<asp:DropDownList id="L8" runat="server" Width="127px" Height="21px"
AutoPostBack="True" >
<asp:ListItem>是</asp:ListItem>
<asp:ListItem>否</asp:ListItem>
</asp:DropDownList></TD>
</tr>
</table>
</TD></TR>
<table id="table1" height="70px" rows=2>
<tr>
<td colspan="0" class="style15">


处理内容</td>

<td colspan="0" Height="16px" class="style21"> 处理结果:</td>
<td class="style11">
<asp:TextBox ID="result" runat="server" Width="60px" ></asp:TextBox>


</td>
<td colspan="0" Height="21px" class="style23"> 处理日期:</td>
<td Width="80px" >
<asp:TextBox ID="ctime" runat="server" Width="115px"></asp:TextBox>
</td>
<td Height="21px" class="style22">检查人:</td>
<td class="style14">
<asp:TextBox ID="user" runat="server" Width="91px" ></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="0" class="style10">


 </td>
<td Height="16px" class="style21" > 备注:</td>
<td class="tdbg" colspan="7" style="height: 17px; width: 120px">
<asp:TextBox id="tb_remark" runat="server" Width="505px" TextMode="MultiLine"
Rows="2" Height="47px"></asp:TextBox></TD>
</tr>
</table>

<table id="table2" height="40px" rows=2>
<tr>
<td colspan="0" class="style25">


 </td>

<td colspan="0" Height="16px" class="style25">
<asp:Button ID="BtnAdd" runat="server" Text="新建" Width="52px" onclick="BtnAdd_Click"
/>
</td>
<td class="style25">
 </td>
<td colspan="0" Height="21px" class="style25">
<asp:Button ID="BtnEdit" runat="server" Text="编辑" Width="52px"
style="height: 26px" onclick="BtnEdit_Click" />
</td>
<td class="style25" >
 </td>
<td Height="21px" class="style25">
<asp:Button ID="BtnSave" runat="server" Text="保存" Width="52px"
/>
</td>

<td class="style25"></td>
<td Height="21px" class="style25">
<asp:Button ID="Button4" runat="server" Text="Button" />
</td>
</tr>
</table>


</table>


</div>
</form>

</body>
</html>




Visual studio2008编写的 dropdownlist c#
[解决办法]
选择一个downlist后,自动刷新重新执行了page_load里的函数SetOpx("INIT"),因asp:downlist是服务器控件,可以改成input控件
[解决办法]
这个是非常基本的概念,你找本正规的asp.net教程看看,了解人家为什么在page_load里边要写上 if(!Postback)。
[解决办法]
if (!Postback)
{
说明是第一次访问,做初始化
}
else
{
控件回发
}

读书人网 >asp.net

热点推荐