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. How to get 2 datas in single column in gridview

How to get 2 datas in single column in gridview

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdatabasesysadmin
4 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.
  • P Offline
    P Offline
    priyamsc
    wrote on last edited by
    #1

    I am using asp.net 2005 with c#. i hv gridview and try to show the datas as forum.I have link button and in link button caption should be database value.i got the value but the problem is id. i need name instead of the id , based on tat id, need to show the name from another table. <asp:TemplateField > <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> </ItemTemplate> </asp:TemplateField> so what i should do for this. 2) my second doubt is how to show 2 datas in single field. tat is in this itemtemplate it shows only one datas but i need to show to idems how to show <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> pls help me,if u knw Thank you in advance

    k.priya

    P C P 3 Replies Last reply
    0
    • P priyamsc

      I am using asp.net 2005 with c#. i hv gridview and try to show the datas as forum.I have link button and in link button caption should be database value.i got the value but the problem is id. i need name instead of the id , based on tat id, need to show the name from another table. <asp:TemplateField > <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> </ItemTemplate> </asp:TemplateField> so what i should do for this. 2) my second doubt is how to show 2 datas in single field. tat is in this itemtemplate it shows only one datas but i need to show to idems how to show <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> pls help me,if u knw Thank you in advance

      k.priya

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      First Doubt Are you able to return name field in your query ? If yes then just provide name field in place of uid. If no then modify you query and join the both table and return result with name field. Second Doubt you can use multiple control in Item template column. For the formating just use Html table.

      Parwej Ahamad http://parwej.wordpress.com/

      1 Reply Last reply
      0
      • P priyamsc

        I am using asp.net 2005 with c#. i hv gridview and try to show the datas as forum.I have link button and in link button caption should be database value.i got the value but the problem is id. i need name instead of the id , based on tat id, need to show the name from another table. <asp:TemplateField > <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> </ItemTemplate> </asp:TemplateField> so what i should do for this. 2) my second doubt is how to show 2 datas in single field. tat is in this itemtemplate it shows only one datas but i need to show to idems how to show <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> pls help me,if u knw Thank you in advance

        k.priya

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Define your item template so it displays two columns of data, if that's what you want. Then they will appear in a single gridview column

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        1 Reply Last reply
        0
        • P priyamsc

          I am using asp.net 2005 with c#. i hv gridview and try to show the datas as forum.I have link button and in link button caption should be database value.i got the value but the problem is id. i need name instead of the id , based on tat id, need to show the name from another table. <asp:TemplateField > <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> </ItemTemplate> </asp:TemplateField> so what i should do for this. 2) my second doubt is how to show 2 datas in single field. tat is in this itemtemplate it shows only one datas but i need to show to idems how to show <ItemTemplate> <asp:LinkButton runat ="server" ID="lnk_pby" Text ='<% #Eval("uid") %>'></asp:LinkButton> pls help me,if u knw Thank you in advance

          k.priya

          P Offline
          P Offline
          priyamsc
          wrote on last edited by
          #4

          Thank you for u both. i got answers.

          k.priya

          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