本文介绍了如何将选中的复选框保存到数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   asp:DataList     ID   ="   dlFav "    runat   ="  服务器"    RepeatColumns   ="   4" 
 
                              RepeatDirection   ="  垂直"    ondeletecommand   ="  dlFav_DeleteCommand"  > 
    <   ItemTemplate  > 
    <  字体   颜色  ="  红色" > 添加的用户:<  /font  >  <   asp:Label     ID   ="   lblUserId"    runat   =" 服务器"   文本  ='  <%#Eval("  AddedUserID" )%> ' >  <  /asp:Label  >  <   br    / > 
    <  字体   颜色  ="  红色" >  ProductID:<  /font  ">>  <   asp:Label     ID   =" "> lblProductID"  =" span>    runat   =" 服务器"   文本  ='  <%#Eval("  ProductID" )%> ' >  <  /asp:Label  >  <   br    / > 
    <  字体   颜色  ="  红色" > 产品名称:<  /font  ">>  <   asp:Label     ID   =" "> lblProductName"  =" span>    runat   =" 服务器"   文本  ='  <%#Eval("  ProductName" )%> ' >  <  /asp:Label  >  <   br    / >> 
    <  字体   颜色  ="  红色" > 价格:<  /font  ">>  <   asp:Label     ID   ="  lblPrice"     runat   =" 服务器"   文本  ='  <%#Eval("  价格")%> ' >  <  /asp:Label  >  <   br    / > 
    <  字体   颜色  ="  红色" > 图片网址:<  /font  >  <   asp:Image     ID   ="   ImageUrl"    runat   =" 服务器"    ImageUrl   ='  <% #Eval("  ImageUrl" )%> ' >  <  /asp:Image  > 
        <   br    / > 
        <   asp:CheckBox     ID   ="  chkDl"     runat   ="  服务器"   文本  ="  选择"   
 
                              CommandName   ="  选择"   / > 
        <   br    / > 


    <  /ItemTemplate  > 
    <  /asp:DataList  >  



 <  表格 > ; 
   <   tr  > 
   <   td  > 

       <   asp:Button     ID   ="  btnadd"     runat   ="  服务器"   文本  ="  添加"   / > 
   <  /td  > 
   <  /tr  > 

    <  /table  >  






这是我的源代码.在复选框中单击我想向数据库中添加数据."可以解决任何一个问题..在要将复选框选中并单击添加"按钮时,我想向数据库中添加乘法数据.我想将数据保存到数据库中. .

解决方案



<asp:DataList ID="dlFav" runat="server" RepeatColumns="4"

            RepeatDirection="Vertical" ondeletecommand="dlFav_DeleteCommand">
    <ItemTemplate>
    <font color="red">Added User:</font><asp:Label ID="lblUserId" runat="server" Text='<%# Eval("AddedUserID") %>'></asp:Label><br />
    <font color="red">ProductID:</font><asp:Label ID="lblProductID" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label><br />
    <font color="red">ProductName:</font><asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label><br />
    <font color="red">Price:</font><asp:Label ID="lblPrice" runat="server" Text='<%# Eval("Price") %>'></asp:Label><br />
    <font color="red">Image Url:</font><asp:Image ID="ImageUrl" runat="server" ImageUrl='<%#Eval("ImageUrl") %>'></asp:Image>
        <br />
        <asp:CheckBox ID="chkDl" runat="server" Text="Select" 

            CommandName="Select" />
        <br />


    </ItemTemplate>
    </asp:DataList>



<table>
   <tr>
   <td>

       <asp:Button ID="btnadd" runat="server" Text="Add" />
   </td>
   </tr>

    </table>






hi this is my source code.in checkbox click i want to add data to database.,.can any one solve..i want to add multiply data to database while selcting checkbox and while clicking add button i want to save data to database..

解决方案




这篇关于如何将选中的复选框保存到数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:34
查看更多