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. how to change datalist's bind fied by codebehind code?

how to change datalist's bind fied by codebehind code?

Scheduled Pinned Locked Moved ASP.NET
htmldockerhelptutorialquestion
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.
  • B Offline
    B Offline
    BigGirlBigEyes
    wrote on last edited by
    #1

    Generally,we can control datalist's display field by databinding in html,such as <%# Container.DataItem("Title") %> Now i have a problem,I want to change this bind field by my option in codebehind file,such as i want to display Title+Digest or Column+Title so who can tell me how to make this done? Thanks in advance! I'm terribly troubled by this problem and looking forward to your reply.

    M 1 Reply Last reply
    0
    • B BigGirlBigEyes

      Generally,we can control datalist's display field by databinding in html,such as <%# Container.DataItem("Title") %> Now i have a problem,I want to change this bind field by my option in codebehind file,such as i want to display Title+Digest or Column+Title so who can tell me how to make this done? Thanks in advance! I'm terribly troubled by this problem and looking forward to your reply.

      M Offline
      M Offline
      Marcie Jones
      wrote on last edited by
      #2

      Hi BGBE, You can put togethere multiple fields right there in the ASPX, such as:

      <%# Container.DataItem("Title") + " " + Container.DataItem("Digest") %>

      Or if you prefer codebehind, you can access the cell during the DataList's ItemDataBound event, and change the cell contents there. Marcie http://www.codeproject.com

      B 1 Reply Last reply
      0
      • M Marcie Jones

        Hi BGBE, You can put togethere multiple fields right there in the ASPX, such as:

        <%# Container.DataItem("Title") + " " + Container.DataItem("Digest") %>

        Or if you prefer codebehind, you can access the cell during the DataList's ItemDataBound event, and change the cell contents there. Marcie http://www.codeproject.com

        B Offline
        B Offline
        BigGirlBigEyes
        wrote on last edited by
        #3

        Thank you for your reply. I want to dynamically created different template,not statically. Now i have solved my problem. I define a datalist in html with ItemTemplate be null,then create serval user control for template,then load them with my different option. Thanks!;P

        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