在做数据查询的时候往往需要对字段进行选择,在实际工作中发现,将字段名放入ListBox控件中,然后将字段逐个或者全部挑选到新的ListBox控件中,实现对表字段名的挑选。实现方法如下:
test.aspx
-----------------------------
.................
<asp:listbox id="ListBox1" style="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 64px" runat="server"
Width="140px" Height="264px"></asp:listbox>
<asp:Button id="Button3" style="Z-INDEX: 111; LEFT: 328px; POSITION: absolute; TOP: 240px" runat="server"
Text="Button"></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 110; LEFT: 328px; POSITION: absolute; TOP: 136px" runat="server"
Text="Button"></asp:Button>
<asp:Label id="lblProblem" style="Z-INDEX: 109; LEFT: 48px; POSITION: absolute; TOP: 32px"
runat="server"></asp:Label>
<asp:DataGrid id="dgResult" style="Z-INDEX: 108; LEFT: 88px; POSITION: absolute; TOP: 336px" runat="server"></asp:DataGrid>
<asp:Button id="Button1" style="Z-INDEX: 107; LEFT: 592px; POSITION: absolute; TOP: 288px" runat="server"
Text="Button"></asp:Button>
<asp:button id="LAll" style="Z-INDEX: 104; LEFT: 344px; POSITION: absolute; TOP: 272px" runat="server"