在公司调试没有问题,回家改了些许东西,居然DropDownList的Autopostback不起作用了。。。郁闷,google了下。。。
没找到目标。。。
1 <div class="font">
2 <asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Aqua"></asp:Label><br />
3 Test Project:
4 <asp:DropDownList ID="listTestProj" runat="server" AutoPostBack="true">
5 </asp:DropDownList>
6 <br />
7 Test Plan:
8 <asp:DropDownList ID="listTestPlan" runat="server" AutoPostBack="true">
9 </asp:DropDownList>
10 <br />
11 <asp:Button ID="submit" runat="server" Text="Submit" OnClick="Do_Click" />
12 </div>
2 <asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Aqua"></asp:Label><br />
3 Test Project:
4 <asp:DropDownList ID="listTestProj" runat="server" AutoPostBack="true">
5 </asp:DropDownList>
6 <br />
7 Test Plan:
8 <asp:DropDownList ID="listTestPlan" runat="server" AutoPostBack="true">
9 </asp:DropDownList>
10 <br />
11 <asp:Button ID="submit" runat="server" Text="Submit" OnClick="Do_Click" />
12 </div>
最后一一比对了修改处,发现问题出在Button上,我定义其ID为submit,修改为Do就没有问题了。
1 <div class="font">
2 <asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Aqua"></asp:Label><br />
3 Test Project:
4 <asp:DropDownList ID="listTestProj" runat="server" AutoPostBack="true">
5 </asp:DropDownList>
6 <br />
7 Test Plan:
8 <asp:DropDownList ID="listTestPlan" runat="server" AutoPostBack="true">
9 </asp:DropDownList>
10 <br />
11 <asp:Button ID="Do" runat="server" Text="Submit" OnClick="Do_Click" />
12 </div>
2 <asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Aqua"></asp:Label><br />
3 Test Project:
4 <asp:DropDownList ID="listTestProj" runat="server" AutoPostBack="true">
5 </asp:DropDownList>
6 <br />
7 Test Plan:
8 <asp:DropDownList ID="listTestPlan" runat="server" AutoPostBack="true">
9 </asp:DropDownList>
10 <br />
11 <asp:Button ID="Do" runat="server" Text="Submit" OnClick="Do_Click" />
12 </div>
估摸着应该是asp.net要求asp.net空间需要放在runat server的form,而form的提交默认为button的submit的缘故。莫名死了。。。