Search code examples
c#asp.netlinqgridviewdatarowview

what' the simplest way to bind my grid view on one record(distinct different data)


What's the simplest way to bind my grid view to a single data row :

I have the following data for example :

dep_code = 3;
dep_name = "computer science";
boss_num = 356;
boss_name ="Ahmed";

i want to bind those data on my gridview.


Solution

  • I think List of list should be simplest

    List<List<string>> list = {{dep_code,dep_name,boss_num,boss_name}};
    GridView1.DataSource = list;
    GridView1.DataBind();