标题标记标记如下所示,它在页面源中生成一个 id,如 FeaturedContent_day3date
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" Runat="Server">
<div id="pagecontent">
<fieldset id="weeklyPnLGoals">
<legend>Weekly PnL Targets with Actual for <%=DateTime.Now.ToString("MMM, yyyy")%></legend>
<div id="monthlywrapper" style="width:100%;">
<div id="firstweekwrapper" class="weekcontainer">
<div id="day1" class="daytile daytilefirst">
<h3 id="day1date" class="dateh3" runat="server"></h3><br />
<p id="day1equities"><span class="targettext"> <span class="bluetext">Equities</span> Target PnL: </span><span id="day1equitytargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Equities</span> PnL: </span><span id="day1equityactualvalue" class="actualtext"></span></p>
<p id="day1options"><span class="targettext"> <span class="bluetext">Options</span> Target PnL: </span><span id="day1optiontargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Options</span> PnL: </span><span id="day1optionactualvalue" class="actualtext"></span></p>
<p id="day1futures"><span class="targettext"> <span class="bluetext">Futures</span> Target PnL: </span><span id="day1futuretargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Futures</span> PnL: </span><span id="day1futureactualvalue" class="actualtext"></span></p>
</div>
<div id="day2" class="daytile">
<h3 id="day2date" class="dateh3" runat="server"></h3><br />
<p id="day2equities"><span class="targettext"> <span class="bluetext">Equities</span> Target PnL: </span><span id="day2equitytargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Equities</span> PnL: </span><span id="day2equityactualvalue" class="actualtext"></span></p>
<p id="day2options"><span class="targettext"> <span class="bluetext">Options</span> Target PnL: </span><span id="day2optiontargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Options</span> PnL: </span><span id="day2optionactualvalue" class="actualtext"></span></p>
<p id="day2futures"><span class="targettext"> <span class="bluetext">Futures</span> Target PnL: </span><span id="day2futuretargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Futures</span> PnL: </span><span id="day2futureactualvalue" class="actualtext"></span></p>
</div>
<div id="day3" class="daytile">
<h3 id="day3date" class="dateh3" runat="server"></h3><br />
<p id="day3equities"><span class="targettext"> <span class="bluetext">Equities</span> Target PnL: </span><span id="day3equitytargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Equities</span> PnL: </span><span id="day3equityactualvalue" class="actualtext"></span></p>
<p id="day3options"><span class="targettext"> <span class="bluetext">Options</span> Target PnL: </span><span id="day3optiontargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Options</span> PnL: </span><span id="day3optionactualvalue" class="actualtext"></span></p>
<p id="day3futures"><span class="targettext"> <span class="bluetext">Futures</span> Target PnL: </span><span id="day3futuretargetvalue" class="targettext"></span><br /><span class="actualtext">Actual <span class="bluetext">Futures</span> PnL: </span><span id="day3futureactualvalue" class="actualtext"></span></p>
</div>
</div>
</div>
</fieldset>
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim firstdate As DateTime = FirstTradingDayInMonth(DateTime.Now.Date)
Dim dayofweeknumber As String = firstdate.Day.ToString()
Dim tradingdaysthismonth As New List(Of Date)
Dim tempDate As Date = firstdate
Do While tempDate.Day < LastTradingDayInMonth(DateTime.Now.Date).Day
If tempDate = firstdate Then
tradingdaysthismonth.Add(tempDate)
tempDate = AddBusinessDays(tempDate)
Else
tempDate = AddBusinessDays(tempDate)
tradingdaysthismonth.Add(tempDate)
End If
Loop
Dim h3Tags As New List(Of HtmlGenericControl)
Dim h3Tagname As String = "day" & dayofweeknumber & "date"
Dim htmlcontrol As HtmlGenericControl = TryCast(Me.Page.FindControl("firstweekwrapper").FindControl(h3Tagname), HtmlGenericControl)
htmlcontrol.InnerText = firstdate.ToLongDateString()
End Sub