简体   繁体   中英

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

How I can pass this value : <%#DataBinder.Eval(Container, "DataItem.QuestionsText")%> , TO THE SUBMIT CODE : database.InsertUpdate(String.Format("CALL spSurveyAnswer_Insert('{0}', '{1}','{2}');", selectValue1, txtFeedBack.Text, IneedToPassitHere )) , by the way , the dataBinder exist in the below code :

 <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>

Thanks in Advance ...

I have solve this problem by adding label to hold the value such as:

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

and then call this label in the repeater function such as:

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

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM