如何创建动态复选框列表供用户选择

时间:2019-03-19 08:03:28

标签: asp.net vb.net visual-studio-2010

使用的应用程序:Visual Studio 2010(vb)

使用的语言:Visual Basic + asp

photo 1: subitem and subcription page

SQL database result photo

案例:我在填充动态复选框字段时遇到问题

示例脚本:

 <tr>
    <td style="width: 40%; height: 50%">
      <!-- added Panel to show vertical scrollbar -->
        <asp:Panel ID="Panel2" runat="server" ScrollBars="Vertical" Height="80%">
     <asp:CheckBoxList ID="cblSub" runat="server" DataSourceID="SqlDataSource1" 
       DataTextField="SubName" DataValueField="SubName">
        </asp:CheckBoxList>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          ConnectionString="<%$ ConnectionStrings:CLMDBconnectionString %>"
          SelectCommand="SELECT * FROM [app_subscription] WHERE deleted = 'N' ">
         </asp:SqlDataSource>
        </asp:Panel>
      </td> 


       <td style="width: 40%; height: 50%">
        <!-- added Panel to show vertical scrollbar -->
     <asp:Panel ID="Panel1" runat="server" ScrollBars="Vertical" Height="80%">
     <asp:CheckBoxList ID="cblsubitem" runat="server" DataSourceID="SqlDataSource2" 
      DataTextField="SubitemName" DataValueField="SubitemName">
     </asp:CheckBoxList>

     <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
      ConnectionString="<%$ ConnectionStrings:CLMDBconnectionString %>"
      SelectCommand="
      Select app_subscriptionItem.SubItemName 
         FROM [CLMDB].[dbo].[app_subscriptionType] 
         Join app_subscriptionItem ON app_subscriptionItem.SubItemID = [app_subscriptionType].SubItemID 
           WHERE [SubID] = @SubID
          END
        ">
      <selectparameters>
     <asp:controlparameter name="SubID" controlid="cblsubitem" propertyname="SelectedValue"/>
      </selectparameters>
     </asp:SqlDataSource>

      </asp:Panel>
        </td> 

我想做的结果:

Photo 2: Contract page that should allow user to populate field

0 个答案:

没有答案