Dynamically adding DropDownList on edit on DataGridView asp.Net on the code

fakir

New Member
Im working on a project just to add few things and one of thoose is to add a DropDownList on a GridView when they press the edit button of a row... Sadly the columns are added on runtime before the database binding, not on the aspx page as all the examples i found, i have it here like this:\[code\]private void SetColumnsGrid(GridView Grid) { BoundField Col = new BoundField();//1 Col.HeaderText = "Name"; Col.DataField = "Name"; Col.HeaderStyle.Width = Unit.Pixel(100); Col.ReadOnly = true; Grid.Columns.Add(Col); Col = new BoundField(); //2 Col.HeaderText = "User Type"; Col.DataField = "UserType"; Col.HeaderStyle.Width = Unit.Pixel(100); Grid.Columns.Add(Col); //Is ddl spected to be here as the TemplateField with the EditItemTemplate?}\[/code\]So, how can i do it? I just dont find the proper way.Whitch events should i handle?Thank you very much
 
Back
Top