C
clintonG
Briefly stated, my problem is accessing and 'setting' properties of a label
control declared in the template of another control noting that the other
control is an instance of the beta 2 DetailsView control which supports a
PagingTemplate.
Somewhere I grabbed some declarations for a PagerTemplate to display paging
as:
<<First < Prev [Record 0 of 5] Next> Last>>
I observed that Record 0 was reported as zero when the DataView was actually
displaying a record. So I thought I'd write some code to normalize the
reported values for users not familiar with zero based data structures.
I attempted to being to normalize by declaring a label in the PagerTemplate;
PageIndicatorLabel..
I can't set the text property of the PageIndicatorLabel control when using
PageIndicatorLabel.Text which make me go "huh?"
// HTML SOURCE
<PagerTemplate>
....
<asp:Label ID="Label8" runat="server" Width="200px"></asp:Label>
<asp:Label ID="PageIndicatorLabel" runat="server" Width="200px"></asp:Label>
....
</PagerTemplate>
// PAGE_LOAD CODE BEHIND
string recordX = DetailsView1.DataItemIndex.ToString( );
string recordY = DetailsView1.PageCount.ToString( );
Control pageIndicator = FindControl("PageIndicatorLabel");
if(pageIndicator != null)
{
// this label's properties can not be set
pageIndicator.Text = "if.pageIndicator.Text";
}
else
{
// this label's properties can not be set
pageIndicator.Text = "if.pageIndicator.Text";
}
Error:
System.Web.UI.Control does not contain a definition for Text
I've tried
Page.FindControl("DetailsView1").FindControl("PageIndicatorLabel"); but
still generate the same error. I'm not initializing the pageIndicator object
correctly or I am misusing the FindControl method because I can not set the
text property for the PageIndicatorLabel.
Where have I gone wrong?
<%= Clinton Gallagher
control declared in the template of another control noting that the other
control is an instance of the beta 2 DetailsView control which supports a
PagingTemplate.
Somewhere I grabbed some declarations for a PagerTemplate to display paging
as:
<<First < Prev [Record 0 of 5] Next> Last>>
I observed that Record 0 was reported as zero when the DataView was actually
displaying a record. So I thought I'd write some code to normalize the
reported values for users not familiar with zero based data structures.
I attempted to being to normalize by declaring a label in the PagerTemplate;
PageIndicatorLabel..
I can't set the text property of the PageIndicatorLabel control when using
PageIndicatorLabel.Text which make me go "huh?"
// HTML SOURCE
<PagerTemplate>
....
<asp:Label ID="Label8" runat="server" Width="200px"></asp:Label>
<asp:Label ID="PageIndicatorLabel" runat="server" Width="200px"></asp:Label>
....
</PagerTemplate>
// PAGE_LOAD CODE BEHIND
string recordX = DetailsView1.DataItemIndex.ToString( );
string recordY = DetailsView1.PageCount.ToString( );
Control pageIndicator = FindControl("PageIndicatorLabel");
if(pageIndicator != null)
{
// this label's properties can not be set
pageIndicator.Text = "if.pageIndicator.Text";
}
else
{
// this label's properties can not be set
pageIndicator.Text = "if.pageIndicator.Text";
}
Error:
System.Web.UI.Control does not contain a definition for Text
I've tried
Page.FindControl("DetailsView1").FindControl("PageIndicatorLabel"); but
still generate the same error. I'm not initializing the pageIndicator object
correctly or I am misusing the FindControl method because I can not set the
text property for the PageIndicatorLabel.
Where have I gone wrong?
<%= Clinton Gallagher