c# - binding difficulty in datagrid -


I am facing some difficulty in binding data in the grid.

My data :

& nbsp; & Nbsp; & Nbsp; Time & nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; 1 & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; 2 & nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 00: 00 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 00.30 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;, & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 01: 00 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 01: 30 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;, & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 02: 00 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;
& nbsp; & Nbsp; 02: 30 & nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & nbsp; & Nbsp; & Nbsp; & Nbsp ;, & nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp;

.. etc ..

My code :

  Public partial class data: System.Web.UI.Page {secure zero page_load (object sender, eventArgues E) {Data1 (); } Public Zero Data 1 () {List & lt; MyKVP & gt; Obj1 = new list & lt; MyKVP & gt; (); & Lt; String & gt; Str = new list & lt; String & gt; () {"Time", "1", "2"}; & Lt; String & gt; Str1 = new list & lt; String & gt; () {"00:00", "00:30", "01:00", "01:30", "02:00", "02:30", "03:00", "03:30" , "04:00"}; For (integer number = 0; count & lt; str1; calculation; calculation ++) {MyKVP obj = new MyKVP (); If (calculation == 0) {obj.Key = "0"; (Int i = 0; i & lt; str.Qount; i ++) for {value o = new value (); O.name = str [i]; Obj.value.Add (o); }} And {obj.Key = Convert.ToString (calculation); Value o = new value (); O.name = ":"; Obj.value.Add (o); } Obj1.Add (obj); } GridView1.DataSource = obj1; GridView1.DataBind (); }} Public class MyKVP {public MyKVP () {value = new list & lt; Value & gt; (); } Public string key {get; Set; } Public listing & lt; Value & gt; Value {receipt; Set; }} Value of public squares {public string name {get; Set; }}  

I'm getting only the keys in the grid, I do not have a list of values ​​in the list.

my xmal

  & lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; / Div & gt; & Lt; Asp: GridView id = "GridView1" runat = "server" & gt; & Lt; / ASP: GridView & gt; & Lt; / Form & gt;  

I think you have to manually configure your gridview, Will do something to try it

  & lt; Asp: gridview id = "gridview 1" runat = "server" auto generated column = "wrong" & gt; & Lt; Columns & gt; & Lt; ASP: BoundfieldDefined = "Key" Header Text = "---" & gt; & Lt; / ASP: Boundfield & gt; & Lt; Asp: TemplateField HeaderText = "---" & gt; & Lt; ItemTemplate & gt; & Lt; ASP: Repeater ID = "Repeater 1" Runat = "Server" datasource = '& lt;% # Eval ("value")% & gt; & Gt; & Lt; ItemTemplate & gt; & Lt;% # Container.Dataite% & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt; & Lt; / ASP: GridView & gt;  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -