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. Gridview in Repeater

Gridview in Repeater

Scheduled Pinned Locked Moved ASP.NET
question
7 Posts 5 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.
  • Z Offline
    Z Offline
    zeeShan anSari
    wrote on last edited by
    #1

    Hi All, let's suppose

    DataSet ds = new DataSet();
    ds.Tables.Add(datatable1)
    ds.Tables.Add(datatable2);

    Repeater1.DataSource = ds;

    then what would be the DataSource="?????" in gridview. Thanks,

    S W T 3 Replies Last reply
    0
    • Z zeeShan anSari

      Hi All, let's suppose

      DataSet ds = new DataSet();
      ds.Tables.Add(datatable1)
      ds.Tables.Add(datatable2);

      Repeater1.DataSource = ds;

      then what would be the DataSource="?????" in gridview. Thanks,

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      zeeShan anSari wrote:

      Repeater1.DataSource = ds;

      Is incorrect. If you have a System.Data.DataSet with multiple tables as a datasource, you must specify which table to bind to the control. Either:

      Repeater1.datasource = datatable1
      //OR
      Repeater1.datasource = ds.Tables[0]

      Same thing for GridView too.

      GridView1.datasource = datatable1
      //OR
      GridView1.datasource = ds.Tables[0]

      Details here: MSDN: Repeater.DataSource Property [^] MSDN: BaseDataBoundControl.DataSource Property [^]

      Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

      A 1 Reply Last reply
      0
      • S Sandeep Mewara

        zeeShan anSari wrote:

        Repeater1.DataSource = ds;

        Is incorrect. If you have a System.Data.DataSet with multiple tables as a datasource, you must specify which table to bind to the control. Either:

        Repeater1.datasource = datatable1
        //OR
        Repeater1.datasource = ds.Tables[0]

        Same thing for GridView too.

        GridView1.datasource = datatable1
        //OR
        GridView1.datasource = ds.Tables[0]

        Details here: MSDN: Repeater.DataSource Property [^] MSDN: BaseDataBoundControl.DataSource Property [^]

        Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

        A Offline
        A Offline
        Apocalypse Now
        wrote on last edited by
        #3

        I don't think so. should: DataSource=Repeater1.DataSource

        S 1 Reply Last reply
        0
        • A Apocalypse Now

          I don't think so. should: DataSource=Repeater1.DataSource

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          ??? :confused:

          Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

          A 1 Reply Last reply
          0
          • Z zeeShan anSari

            Hi All, let's suppose

            DataSet ds = new DataSet();
            ds.Tables.Add(datatable1)
            ds.Tables.Add(datatable2);

            Repeater1.DataSource = ds;

            then what would be the DataSource="?????" in gridview. Thanks,

            W Offline
            W Offline
            wikizhao
            wrote on last edited by
            #5

            put ul li in it Repeater, that can Meet your needs!You try!

            1 Reply Last reply
            0
            • S Sandeep Mewara

              ??? :confused:

              Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

              A Offline
              A Offline
              Apocalypse Now
              wrote on last edited by
              #6

              DataSource connect Database , Not table.

              1 Reply Last reply
              0
              • Z zeeShan anSari

                Hi All, let's suppose

                DataSet ds = new DataSet();
                ds.Tables.Add(datatable1)
                ds.Tables.Add(datatable2);

                Repeater1.DataSource = ds;

                then what would be the DataSource="?????" in gridview. Thanks,

                T Offline
                T Offline
                taha bahraminezhad Jooneghani
                wrote on last edited by
                #7

                you can't set to table for repeater datasource, set it as one, or if you need each of them, use view in sql database, or use union linq method, that get it in one source! like this:

                var ds = (table1)Union(table2).ToList();
                repeater1.DataSource = ds;

                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