Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name 'lblCurrentPage' is not declared Message

Status
Not open for further replies.

PsychoCoder

Programmer
May 31, 2006
140
US
This is driving me crazy! On my page I have this:

Code:
  <td colspan="5">
    <ASP:LABEL ID="lblCurrentPage" RUNAT="server" TEXT="Label"></ASP:LABEL>
  </td>
....
....
  <tr>
    <td>
      <ASP:LINKBUTTON ID="cmdPrev" RUNAT="server" TEXT="<< Prev"	/>
    </td>
    <td>
      <ASP:LINKBUTTON ID="cmdNext" RUNAT="server" TEXT="Next >>"/>
    </td>

In the code behind Im referencing the above controls like this:
Code:
   lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString + " of " + Pager.PageCount.ToString
   cmdPrev.Enabled = Not Pager.IsFirstPage
   cmdNext.Enabled = Not Pager.IsLastPage

But Im getting the following error:
Code:
Line 52: 			Pager.PageSize = 25
Line 53: 			Pager.CurrentPageIndex = CurrentPage
[b]Line 54: 			lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString + " of " + Pager.PageCount.ToString[/b]
Line 55: 			cmdPrev.Enabled = Not objPds.IsFirstPage
Line 56: 			cmdNext.Enabled = Not objPds.IsLastPage

The bolded line is where the error is happeningn (and in my code behind the 2 lines referncing the LinkButtons are underlined in blue saying they havent been declared.

Senior Qik III, ASP.Net, VB.Net ,SQL Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Do NOT feed Code Gremlins after midnight **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Try putting the </asp:LinkButton> tags at the end of the LinkButton declarations.
 
Fixed the problem,

Forgot the controls are insied a repeater so I had to change to:Me.current_apps.FindControl("lblCurrentPage").Text and the same for the LinkButtons.

Senior Qik III, ASP.Net, VB.Net ,SQL Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Do NOT feed Code Gremlins after midnight **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top