Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. datasource in repeater

datasource in repeater

Scheduled Pinned Locked Moved ASP.NET
csharpdockerhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rturner003
    wrote on last edited by
    #1

    <%# DataBinder.Eval(Container.DataItem,"title")%>

    <%#DataBinder.Eval(Container.DataItem,"ward")%>
    In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire Council

    A A 2 Replies Last reply
    0
    • R rturner003

      <%# DataBinder.Eval(Container.DataItem,"title")%>

      <%#DataBinder.Eval(Container.DataItem,"ward")%>
      In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire Council

      A Offline
      A Offline
      Angel Reyes
      wrote on last edited by
      #2

      I haven't had any need to use the datalist before but I would imagine that it works much like the datagrid. Within the ItemDataBound event (which will fire for each row in the datasource) you will be able to do something like what you were already trying to do... Repeater rptTem = (Repeater)e.Item.FindControl("rptWards") Again, take a look at the ItemDataBound[^] event. I might be wrong, but I think you were just looking for it in the wrong place.

      1 Reply Last reply
      0
      • R rturner003

        <%# DataBinder.Eval(Container.DataItem,"title")%>

        <%#DataBinder.Eval(Container.DataItem,"ward")%>
        In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire Council

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        first of all, check if the datasource is initialised properly and has a data table.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups