Reputation: 51124
I have several sections of markup in a report that look like this:
<div class="report-section span-24 last">
<h3 class="section-header">
Municipal Valuation</h3>
<p class="section-desc">
<img src='<%= ResolveUrl("~/Images/info-icon.png")%>' class="left" alt="Section Description" />
The <strong>Municipal Valuation</strong> is the valuation provided by the relevant
municipality and represents the market value assessed for rates purposes as at the
date of valuation.</p>
</div>
I would like to create a user control that encapsulates everything that is the same in each section, so that I can instead define my sections like this:
<lsReport:Section ID="reportDetails" runat="server" Title="Transfer Information">
<Description>The <strong>Municipal Valuation</strong> is the valuation provided by the relevant
municipality and represents the market value assessed for rates purposes as at the
date of valuation.</Description>
</lsReport:Section>
So that the title is always in a <h3 class="section-header">
and the description paragraph always has the image, etc. How do I go about this? I can already define the Description text in an attribute on the control, but some descriptions are long, and contain markup. I would like to know how to set the control's Description property using the Description child element of the control element.
Upvotes: 0
Views: 68
Reputation: 3475
I think you can accomplish what you are trying to do with a custom templated user control.
<uc:lstReport id="report1" Title="somevalue" runat="server">
<Description>
Some custom content you want rendered in the desc.
</Description>
<ItemTemplate>
Here is a calendar: <asp:calendar id="cal1" runat="server" />
</ItemTemplate>
</uc:lstReport>
Check out this link as a starter.
Upvotes: 2