簡體   English   中英

通過提交按鈕將ASP.NET Repeater中的DataBinder值傳遞到數據庫

[英]Pass DataBinder value in ASP.NET Repeater to database through submit button

我如何傳遞此值: <%#DataBinder.Eval(Container, "DataItem.QuestionsText")%>到提交代碼: database.InsertUpdate(String.Format("CALL spSurveyAnswer_Insert('{0}', '{1}','{2}');", selectValue1, txtFeedBack.Text, IneedToPassitHere )) ,順便說database.InsertUpdate(String.Format("CALL spSurveyAnswer_Insert('{0}', '{1}','{2}');", selectValue1, txtFeedBack.Text, IneedToPassitHere ))存在於以下代碼中:

 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">

     <HeaderTemplate>
         <table class="tblcolor">
             <tr class="rowcolor">
             <b>
             </b>
             </tr>
</HeaderTemplate>

     <ItemTemplate>
<tr class="tblrowcolors">
<td>  <%#DataBinder.Eval(Container, "DataItem.QuestionsText")%></td>


     <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">

   <asp:ListItem Text="1" selected="true" Value="Item1"/> 
   <asp:ListItem Text="2" Value="Item2"/>
   <asp:ListItem Text="3" Value="Item3"/> 
   <asp:ListItem Text="4" Value="Item4"/> 
   <asp:ListItem Text="5" Value="Item5"/> 



    </asp:RadioButtonList>

提前致謝 ...

我已經通過添加標簽來保存該值來解決此問題,例如:

<asp:Label ID="Label1" runat="server" Text='<%# Eval("Survey_Questions_ID")%>' Visible="false"></asp:Label>

然后在轉發器函數中調用此標簽,例如:

Label lbl = (Label)item.FindControl("Label1");
Response.Write(lbl.Text);

干杯

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM