Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3238276
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:50:07+00:00 2026-05-17T17:50:07+00:00

Here’s my data table in my SQL DB, and below that is the code

  • 0

Here’s my data table in my SQL DB, and below that is the code for my Repeater control:

ArticleID int NOT NULL,
ArticleTitle varchar(100) NOT NULL,
ArticleCategory int NOT NULL,
ArticleDate datetime NOT NULL,
ArticleContent text NOT NULL,
DeletedYN char(3) NOT NULL

<asp:Repeater runat="server" ID="rptArticles" DataSourceID="dsLatestArticles">
    <HeaderTemplate>
        <span class="title"><%#Container.DataItem("ArticleTitle")%></span><br />
        <span class="title3">Posted On: <%#Container.DataItem("ArticleDate")%></span>
    </HeaderTemplate>
    <ItemTemplate><p><%#Container.DataItem("ArticleContent")%></p></ItemTemplate>
    <FooterTemplate>
        <p class="RightAlign"><a href="/Articles/Read.aspx?i=<%#Container.DataItem("ArticleID") %>">Read more...</a></p>
    </FooterTemplate>
</asp:Repeater>

When I try to load the page this is on, I get an error saying Object variable or With block variable not set.

For reference, my SqlDataSource is configured as follows:

<asp:SqlDataSource ID="dsLatestArticles" runat="server" 
    ConnectionString="<%$ ConnectionStrings:VBSiteConnectionString %>"        
    SelectCommand="SELECT [ArticleID], [ArticleTitle], [ArticleDate], [ArticleContent] FROM [Articles] WHERE ([DeletedYN] = @DeletedYN)">
    <SelectParameters>
        <asp:Parameter DefaultValue="No" Name="DeletedYN" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>

I don’t know what I’ve done wrong here, can anyone see a problem?
For further reference, here’s my Stack Trace:

[NullReferenceException: Object variable or With block variable not set.]
   Microsoft.VisualBasic.CompilerServices.Container..ctor(Object Instance) +510276
   Microsoft.VisualBasic.CompilerServices.NewLateBinding.InternalLateIndexGet(Object Instance, Object[] Arguments, String[] ArgumentNames, Boolean ReportErrors, ResolutionFailure& Failure) +88
   Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateIndexGet(Object Instance, Object[] Arguments, String[] ArgumentNames) +21
   ASP.default_aspx.__DataBind__control3(Object sender, EventArgs e) in D:\Development\Projects\Web\LogansArchive\Default.aspx:9
   System.Web.UI.Control.OnDataBinding(EventArgs e) +99
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.Control.DataBindChildren() +211
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
   System.Web.UI.Control.DataBind() +15
   System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +124
   System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +323
   System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51
   System.Web.UI.WebControls.Repeater.DataBind() +75
   System.Web.UI.WebControls.Repeater.EnsureDataBound() +55
   System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +15
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:50:07+00:00Added an answer on May 17, 2026 at 5:50 pm

    In case someone else comes across this problem, here’s a solution that I’ve found

    The Cause
    I was pulling data from my SqlDataSource in the <HeaderTemplate> section of my Repeater control.
    This is what caused the problem. I’m not sure why, but the point is that doing this will not work.

    The Solution
    All data retrieval (i.e. <%#Container.DataItem("Field1") %> block) must be used in the <ItemTemplate> section of the Repeater control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's what I'm trying do to in a single SQL Server procedure: @ID1 int
This is beyond both making sense and my control. That being said here is
here a a piece of code that is supposed to loop over and over
Here is an example table: ID time data type 0 0100 xyz 0 1
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here's a coding problem for those that like this kind of thing. Let's see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.