asp.net - How to find a div / panel in repeater and apply css? -


the goal

to add cssclass div inside repeater if bit column in sql table true.

current code

  <asp:repeater id="rpt1" runat="server" onitemdatabound="rpt1_itemdatabound">     <itemtemplate>       <asp:panel id="pnl1" runat="server"></asp:panel>     </itemtemplate>   </asp:repeater>  protected sub rpt1_itemdatabound(sender object, e repeateritemeventargs)     if e.item.itemtype = listitemtype.item or e.item.itemtype = listitemtype.alternatingitem         if e.item.dataitem("mybitcol") = true             dim div1 = ctype(rpt1.findcontrol("pnl1"), panel)             div1.attributes.add("class", "myclass")         end if     end if end sub 

the repeater correctly bound on page load , populated sp includes column 'mybitcol'

questions

how find , target div inside repeater code behind?

how retrieve mssql column value bound repeater? (column bound repeater not called on aspx page. needs called in code behind).

to find panel:

{     dim pnlsubcategories panel = directcast(e.item.findcontrol("pnl1"),panel)     pnlsubcategories.cssclass="yourclass" } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -