Add multiple records to a GridView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flashleo
    New Member
    • Apr 2009
    • 4

    Add multiple records to a GridView

    string imgg=1,3,4,9,18 ,

    imgg=imgg.TrimE nd(',');
    string[] words = imgg.Split(',') ;
    foreach (string word in words)
    {
    strrr = "select * from profiles where proid=" + int.Parse(word) ;
    SqlDataSource2. SelectCommand = strrr;
    GridView2.DataS ourceID = "sqldatasource2 ";
    GridView2.DataB ind();
    }

    I am trying to add data to gridview in a loop with comma separated string. But everytime gridview remove previous data and bind only with last id. Please help i want to plus record in gridview with every loop.
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    #2


    Check this out

    Comment

    Working...