N
nic
I have a user control with properties exposed as:
Public Scorecard As Integer, _
Store As Integer, _
MonthNo As Integer, _
YearNo As Integer
I can set these properties from the calling page and can response.write
these values within the user control. BUT! I cannot access these values
within functions that I have on the page. I have tried using the property
set/get syntax and seperate private variables as well, but it makes no
difference. What am I missing here?
Thanks
nick
Here is the user control code:
<%@ Control Language="VB" debug="true" %>
<%@ import Namespace="System.Configuration" %>
<%@ import Namespace="Microsoft.ApplicationBlocks.Data" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Private strConn As string =
ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_cnBSC")
Private intPerspective As Integer
'Exposed properties
Public Scorecard As Integer, _
Store As Integer, _
MonthNo As Integer, _
YearNo As Integer
Private Sub GetParentHeaders()
rptPerspectives.DataSource = SqlHelper.ExecuteReader(strConn,
"dbo.spGetAllPerspectives")
rptPerspectives.DataBind()
End Sub
Private Function GetChildLinks(ByVal intPer as Integer) As SqlDataReader
Return SqlHelper.ExecuteReader(strConn,
"dbo.spGetMeasurePerformanceForPerspective", Scorecard, intPer, Store,
MonthNo, YearNo)
End Function
Private Sub Page_Load(Src As Object, E As EventArgs)
GetParentHeaders()
End Sub
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" border="0"
id="tblRepeaterData">
<asp:repeater id="rptPerspectives" runat="server" >
<ItemTemplate>
<tr>
<td colspan="10" bgcolor="#999999"><h2><%#
DataBinder.Eval(Container.DataItem, "per_name") %></h2></td>
</tr>
<tr>
<td rowspan="2"><h3>Objective</h3></td>
<td rowspan="2" class="style1"><h3>Measure</h3></td>
<td rowspan="2" class="style1"><h3>Weighting</h3></td>
<td colspan="3"><div align="center">
<h3>Target</h3>
</div></td>
<td rowspan="2" class="style1"><h3>Score</h3></td>
<td rowspan="2" class="style1"><h3>Prev</h3></td>
<td rowspan="2"><h3>% Change </h3></td>
<td rowspan="2" class="style1"> </td>
</tr>
<tr>
<td><div align="center">
<h3>6m</h3>
</div></td>
<td><div align="center">
<h3>1y</h3>
</div></td>
<td><div align="center">
<h3>3y</h3>
</div></td>
</tr>
<%
Response.Write("Scorecard=" & Scorecard)
Response.Write("<br>Store=" & Store)
Response.Write("<br>MonthNo=" & MonthNo)
Response.Write("<br>YearNo=" & YearNo)
%>
<asp:repeater id="rptScores" runat="server" DataSource='<%#
GetChildLinks(CType(DataBinder.Eval(Container.DataItem, "per_id"),Integer))
%>'>
<ItemTemplate>
<tr>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"ob_name") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_name") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_weighting") %>%</td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_6m") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_1y") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_3y") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"sp_score") %></td>
<td class="style3"> </td>
<td class="style3"> </td>
</tr>
</ItemTemplate>
</ASP:Repeater>
<tr>
<td colspan="10"> </td>
</tr>
</ItemTemplate>
</asp:repeater>
</table>
Public Scorecard As Integer, _
Store As Integer, _
MonthNo As Integer, _
YearNo As Integer
I can set these properties from the calling page and can response.write
these values within the user control. BUT! I cannot access these values
within functions that I have on the page. I have tried using the property
set/get syntax and seperate private variables as well, but it makes no
difference. What am I missing here?
Thanks
nick
Here is the user control code:
<%@ Control Language="VB" debug="true" %>
<%@ import Namespace="System.Configuration" %>
<%@ import Namespace="Microsoft.ApplicationBlocks.Data" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Private strConn As string =
ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_cnBSC")
Private intPerspective As Integer
'Exposed properties
Public Scorecard As Integer, _
Store As Integer, _
MonthNo As Integer, _
YearNo As Integer
Private Sub GetParentHeaders()
rptPerspectives.DataSource = SqlHelper.ExecuteReader(strConn,
"dbo.spGetAllPerspectives")
rptPerspectives.DataBind()
End Sub
Private Function GetChildLinks(ByVal intPer as Integer) As SqlDataReader
Return SqlHelper.ExecuteReader(strConn,
"dbo.spGetMeasurePerformanceForPerspective", Scorecard, intPer, Store,
MonthNo, YearNo)
End Function
Private Sub Page_Load(Src As Object, E As EventArgs)
GetParentHeaders()
End Sub
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" border="0"
id="tblRepeaterData">
<asp:repeater id="rptPerspectives" runat="server" >
<ItemTemplate>
<tr>
<td colspan="10" bgcolor="#999999"><h2><%#
DataBinder.Eval(Container.DataItem, "per_name") %></h2></td>
</tr>
<tr>
<td rowspan="2"><h3>Objective</h3></td>
<td rowspan="2" class="style1"><h3>Measure</h3></td>
<td rowspan="2" class="style1"><h3>Weighting</h3></td>
<td colspan="3"><div align="center">
<h3>Target</h3>
</div></td>
<td rowspan="2" class="style1"><h3>Score</h3></td>
<td rowspan="2" class="style1"><h3>Prev</h3></td>
<td rowspan="2"><h3>% Change </h3></td>
<td rowspan="2" class="style1"> </td>
</tr>
<tr>
<td><div align="center">
<h3>6m</h3>
</div></td>
<td><div align="center">
<h3>1y</h3>
</div></td>
<td><div align="center">
<h3>3y</h3>
</div></td>
</tr>
<%
Response.Write("Scorecard=" & Scorecard)
Response.Write("<br>Store=" & Store)
Response.Write("<br>MonthNo=" & MonthNo)
Response.Write("<br>YearNo=" & YearNo)
%>
<asp:repeater id="rptScores" runat="server" DataSource='<%#
GetChildLinks(CType(DataBinder.Eval(Container.DataItem, "per_id"),Integer))
%>'>
<ItemTemplate>
<tr>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"ob_name") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_name") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_weighting") %>%</td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_6m") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_1y") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"mes_target_3y") %></td>
<td class="style3"><%# DataBinder.Eval(Container.DataItem,
"sp_score") %></td>
<td class="style3"> </td>
<td class="style3"> </td>
</tr>
</ItemTemplate>
</ASP:Repeater>
<tr>
<td colspan="10"> </td>
</tr>
</ItemTemplate>
</asp:repeater>
</table>