David
David

Reputation: 593

Using asp:Literal text in html attributes

quick question. Is there a way to use asp:Literal text in an HTML attribute?

Example

<asp:Literal Text="hidden" runat="server" ID="ClassTag"></asp:Literal>

<tr class='<%= ClassTag %>' run="server" > </tr>

I am working on an overall solution to a repeater table row collapsing problem (asp:repeater collapsing table rows) for context, and this is perhaps the last thing I'm stuck on.

Please let me know. Thanks!

Upvotes: 3

Views: 1293

Answers (1)

Paul-Jan
Paul-Jan

Reputation: 17278

Not really, but are you just trying to set the class on the TR from code?

In that case, write the following the ASP.NET:

<tr runat="server" ID="CustomRow">

And in the codebehind set the class through the Attributes collection:

CustomRow.Attributes.Add("class", "[desired css class]");

Upvotes: 3

Related Questions