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
  1. Home
  2. Web Development
  3. ASP.NET
  4. repeater databinding @ server side

repeater databinding @ server side

Scheduled Pinned Locked Moved ASP.NET
sysadmindockerquestion
3 Posts 2 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.
  • F Offline
    F Offline
    fififlowertot
    wrote on last edited by
    #1

    Hi,
    I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do

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

    ...

    as the dataItem will be different. Which is the best way to do it server side?

    Thanks,

    N 1 Reply Last reply
    0
    • F fififlowertot

      Hi,
      I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do

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

      ...

      as the dataItem will be different. Which is the best way to do it server side?

      Thanks,

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true; Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource


      I know the language. I've read a book. - _Madmatt

      F 1 Reply Last reply
      0
      • N Not Active

        If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true; Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource


        I know the language. I've read a book. - _Madmatt

        F Offline
        F Offline
        fififlowertot
        wrote on last edited by
        #3

        yes I had set the autogenerate columns as true and it works fine. Issue is I also had a jquery to select the selected row value and it ended up having lots of magic numbers for the colums in different states. Very difficult to understand and maintain. I want to access dataItem value on row click and hence trying to map dynamically . Thanks,

        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