tags:

views:

178

answers:

1

Hi All. I have to change td content dynamically that depends on checkbox. If checkbox isnot checked td will not take an extra style but if checked my text must take such a style:

b style="font-family:Tahoma;font-size:8pt;color:#0f0000;font-weight:normal;">My Text</b

Mycode is like that:

asp:DataList ID="Inside" runat="server" RepeatColumns="4"

ItemTemplate

  <asp:HiddenField ID="FeaID2" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "FeatureID")%>' >

    <td class="checkbox_td"><input disabled="disabled" type="checkbox" <%# int.Parse(DataBinder.Eval(Container.DataItem, "exist").ToString()) > 0 ? "checked" : "" %> /></td>

    <td class="text_td">!!!HERE IS MY PROBLEM!!!</td>

/ItemTemplate

/asp:DataList

I use C#, So, How do i give extra style to td content dynamically that i call (HERE IS MY PROBLEM) that depends on checkbox below?

A: 

Add another selector to you CSS:-

td.text_td_checked { font-family:Tahoma;font-size:8pt;color:#0f0000;font-weight:normal; }

Make sure it comes after the text_td selector in your CSS. In your TD :-

<td class="text_td <%# int.Parse(DataBinder.Eval(Container.DataItem, "exist").ToString()) > 0 ? "text_td_checked" : "" %>">!!!Problem Solved!!!</td>
AnthonyWJones
Thanks Anthony, it is very easy, isnt it? :) I must learn a lot :)
Mehmet Kaleli