Bind the grid

Last post 05-11-2009 8:23 AM by kavita_khandhadia. 6 replies.

Sort Posts:

  • Bind the grid

    05-07-2009, 8:18 AM
    • Member
      8 point Member
    • vijaynetpart
    • Member since 03-24-2009, 4:05 AM
    • Posts 31

     Hello all,

    I like to bind the grid using collection concept(Not Dataset)....

    In these conecpts how can i get the data from the database, and insert into collections and bind the grid..

    Plz send the sample code

    @Vijay@
    Filed under:
  • Re: Bind the grid

    05-07-2009, 8:39 AM
    • Member
      8 point Member
    • vijaynetpart
    • Member since 03-24-2009, 4:05 AM
    • Posts 31

     which one gives the best performance ??(Dataset or Collection)

    and Why??

    @Vijay@
  • Re: Bind the grid

    05-07-2009, 8:54 AM

    Well i think... dataset it self is a colletion of datatables.. and data tables are collection of rows.. so ultimately Dataset is collection of collections....

    now in oppose to this u are tokin about which collection? there can be so many collections..

    well to bind the gridview to collection. refer this link

    http://www.webdeveloper.com/forum/archive/index.php/t-88488.html

     

     

    Please mark this post as Answer if it is of help to you!

    " Every wall is a door..! "
  • Re: Bind the grid

    05-08-2009, 1:56 AM
    • Member
      54 point Member
    • Sheetal.Bhatt
    • Member since 10-23-2007, 1:00 PM
    • Ahmedabad,India
    • Posts 111

     Dataset will give good performance

  • Re: Bind the grid

    05-08-2009, 9:12 AM
    • Member
      8 point Member
    • vijaynetpart
    • Member since 03-24-2009, 4:05 AM
    • Posts 31

     Thanks ur reply kavitha,

    Can u please send me the detailed code or any sample projects which is developed by you.

    vijaycit@yahoo.co.in


     

    @Vijay@
  • Re: Bind the grid

    05-08-2009, 9:12 AM
    • Member
      8 point Member
    • vijaynetpart
    • Member since 03-24-2009, 4:05 AM
    • Posts 31

     Thanks ur reply kavitha,

    Can u please send me the detailed code or any sample projects which is developed by you using collection concepts.

    vijaycit@yahoo.co.in


     

    @Vijay@
  • Re: Bind the grid

    05-11-2009, 8:23 AM
    Answer

    vijaynetpart:

     Thanks ur reply kavitha,

    Can u please send me the detailed code or any sample projects which is developed by you using collection concepts.

    vijaycit@yahoo.co.in


     

     

    DataTable dt = new DataTable();
            dt.Columns.Add("roomCode");
            dt.Columns.Add("roomNo");
            dt.Columns.Add("hotelCode");
     
           

            DataRow dr;

            dr = dt.NewRow();
            dr["roomCode"] = "1";
            dr["roomNo"] = "MKavs";
            dr["hotelCode"] = "222";
          
           

            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["roomCode"] = "2";
            dr["roomNo"] = "232";
            dr["hotelCode"] = "33";
           

            dt.Rows.Add(dr);

            gv.DataSource = dt;
            gv.DataBind();

            //see above code : this is how u create a DataTable. Here u can see dr is the DataRows. So DataTable is collection of DataRows




            DataSet ds = new DataSet();
            ds.Tables.Add(dt);

            //see above code : now i have added this table in to dataSet..i coud add more table to the dataset by doin something like this
            //ds.Tables.Add(dt2); and so on.

            //now to retrive the table from data set u have to do some thing liek this

            DataTable newDt = ds.Tables[0];
     

    Please mark this post as Answer if it is of help to you!

    " Every wall is a door..! "
Page 1 of 1 (7 items)