c# - I Can't Use/Call the TextBox Inside the Item Template in the aspx.cs -


as can see have textbox in itemtemplate. want is: want use txturunid in database code in default.aspx.cs can not find txturunid. can do?

<asp:repeater id="repeater2" runat="server" datasourceid="sqldatasource2">     <itemtemplate>         <li class="<%#eval("urunkategoriadi") %>">             <figure>                 <div class="gallery-img"><asp:linkbutton id="linkbutton1" runat="server" onclick="linkbutton1_click"><img src="<%#eval("urunresmi") %>" alt="" /></asp:linkbutton></div>                 <figcaption>                     <asp:textbox id="txturunid" runat="server" cssclass="form-control" text='<%#eval("urunid") %>' visible="false"></asp:textbox>                     <h3><%#eval("urunadi") %></h3>                     <p>Ürün hakkında detaylı bilgi için tıklayınız.</p>                 </figcaption>             </figure>         </li>     </itemtemplate> </asp:repeater> <asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<%$ connectionstrings:aytasarimconnectionstring %>" selectcommand="select [urunid], [urunadi], [urunkategoriadi], [urunresmi] [urun]"></asp:sqldatasource> 

default.aspx.cs page , sql code (select code) here:

i guess can't access textbox because it's inside repeater. means have more 1 textbox. may able access code this:

foreach (repeateritem item in repeater2.items) {   textbox txtname= (textbox)item.findcontrol("txturunid");   if(txtname!=null)   {     //do txtname.text   } } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -