in

CodeSmith Community

Your Code. Your Way. Faster!

Repeater controls

Last post 03-27-2008 1:58 PM by bslatner. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-27-2008 11:41 AM

    • bslatner
    • Top 500 Contributor
    • Joined on 10-25-2007
    • Charlotte, NC
    • Posts 19
    • Points 485

    Repeater controls

    There seems to be a small bug with the repeater controls. 

    If you don't have a data source on your ASPX page and you don't assign one to the controls on the server side, they throw an "Object reference not set to an instance of an object" exception in the CreateChildControls method.

    I'm pretty sure this can be fixed just by surrounding the foreach in the middle with an "if (dataSource != null)", like so:

                 if (dataSource != null)
                 {
                     foreach (object o in dataSource)
                     {

                        /* details omitted */
                    }
                 }
     

    • Post Points: 35
  • 03-27-2008 1:25 PM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Grand Rapids, MI
    • Posts 94
    • Points 1,740

    Re: Repeater controls

    I'm outside ur box, shiftin' ur paradigm.
    • Post Points: 35
  • 03-27-2008 1:58 PM In reply to

    • bslatner
    • Top 500 Contributor
    • Joined on 10-25-2007
    • Charlotte, NC
    • Posts 19
    • Points 485

    Re: Repeater controls

    Thanks much!
    • Post Points: 5
Page 1 of 1 (3 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems