Name 'btnPrev' is not declared. How do I do that?

  • Thread starter Thread starter darrel
  • Start date Start date
D

darrel

I'm working on getting paging working for a repeater control.

I'm following the tutorial at:
http://www.sitepoint.com/print/asp-nets-pageddatasource

I'm getting snagged on the following bit of code:

Line 121: btnPrev.Visible = (NOT pagedData.IsFirstPage)
Line 122: btnNext.Visible = (NOT pagedData.IsLastPage)

Which gives me the 'btnPrev' is not declared.

However, I do have it in my repeater control, located on the same page:

<FooterTemplate>
<asp:LinkButton id="btnPrev" text="&lt;" OnClick="Prev_Click"
runat="server" />
<asp:LinkButton id="btnNext" text="&lt;" OnClick="Next_Click"
runat="server" />
</FooterTemplate>

What am I missing?

-Darrel
 
Best guess: I would Ensure you have a declaration of the button in your
codeBehind (or <% %> blocks).

protected System.Web.UI.WebControls.Button btnPrev;

When you place the buttons into the page in the background like this, the
IDE does not link them to the page, as the Repeater will only run if there
is data.

NOTE: You must ensure there is always data in the Repeater, or this will
cause a problem.

I would consider extending the Repeater control, if this is going to be a
common functionality.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA


**********************************************************************
Think Outside the Box!
**********************************************************************
 
Best guess: I would Ensure you have a declaration of the button in your
codeBehind (or <% %> blocks).

Ah...yes...I think the tutorial implies that I'm using VS.net and as I'm
doing this by hand, I miss the automated declarations. Thanks!

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top