当前位置:编程学习 > C#/ASP.NET >>

请高手帮忙解决问题



如上图,图中的CHECKBOX和旁边的文字是从数据库中读出的,我想在选中CHECKBOX的同时将数据库中与文字对应的ID传出来,怎么实现请高手帮忙  --------------------编程问答-------------------- ID传出来?怎么传,传到哪里?

读取的时候就把ID也取出来,放到checkbox里面,每次选择checkbox的时候,在onclick里面去处理相应的ID值 --------------------编程问答-------------------- 求助啊,请高手帮忙看看啊 --------------------编程问答-------------------- http://www.w3schools.com/Ajax/default.asp --------------------编程问答-------------------- 这是我写的,我不知道ID怎么传,请帮我看看
<form id="form1" runat="server">
    <div>
        <asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
            DataTextField="leibie" DataValueField="id">
            
        </asp:CheckBoxList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:eastday365ConnectionString %>"
            SelectCommand="SELECT * FROM [leibie] WHERE ([ChildNum] = @ChildNum) ORDER BY [id] DESC">
            <SelectParameters>
                <asp:Parameter DefaultValue="0" Name="ChildNum" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        
        <asp:CheckBoxList ID="CheckBoxList2" RepeatDirection="Horizontal" CellPadding="5" CellSpacing="5" runat="server" AutoPostBack="true" DataSourceID="SqlDataSource2"
            DataTextField="leibie" DataValueField="id">
        </asp:CheckBoxList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:eastday365ConnectionString %>"
            SelectCommand="SELECT * FROM [leibie] WHERE (([ChildNum] = @ChildNum) AND ([ParentID] = @ParentID))">
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="ChildNum" Type="Int32" />
                <asp:ControlParameter ControlID="CheckBoxList1" Name="ParentID" PropertyName="Value"
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        </div>
    </form> --------------------编程问答-------------------- 求助啊,请高手帮忙看看啊
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,