1

What I have is this:

<table>
   <tr bgcolor="#007ACC" style="color:White">
      <td width="145">Account Group</td>
      <td width="80"></td>
      <td width="10">Active</td>
   </tr>
   <tr>
    ·
    ·
   </tr>
</table>

What I need to do is make it so "Account Group" can be changed based on a user's treeview selection. i.e., if the user selects a Child node, I need to change that to "Account Number".

Is it possible to change a table element on-the-fly like that? If so, how would I do this?

1
  • You only need to do this for a single td ? Commented Jan 12, 2016 at 16:12

2 Answers 2

4

Place a label in <td> to display text, so that you can change them based on label id

 <td width="145">
    <asp:Label Text="Account Group" ID="lblUserContent" runat="server" />
 </td>

As per treeview selection changes you can change the text by using following code:

if(your condition)
   lblUserContent.Text="Account Number"
else
   lblUserContent.Text="Account Group"
Sign up to request clarification or add additional context in comments.

1 Comment

Frickin' genius. Thanks!!
2

The best way to do this will depend on how you're using your treeview, but here's a quick way to output the value of a C# variable into your table:

<table>
  <tr bgcolor="#007ACC" style="color:White">
    <td width="145"><%# Eval("MyCSharpVariable") %></td>
    <td width="80"></td>
    <td width="10">Active</td>
  </tr>
  <tr>
  ·
  ·
  </tr>
</table>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.