<asp:GridView ID="grd_DSR" runat="server" AllowPaging="True" CellPadding="4" ForeColor="#333333" PageSize="3" Width="100%" AutoGenerateColumns="false" Height="16px" TabIndex="25" onrowcancelingedit="grd_DSR_RowCancelingEdit" > <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns>; ; and my code behind file is: public void loadDynamicGrid() { #region Code for preparing the DataTable #region constants string ProductName_Product_Types="ProductName/Product_Types"; string Total_prise = "Total_Prise"; DataSet ds; FillDsr fd = new FillDsr(); fd.action = "SelectPackName"; ds = fd.LoadPackName(fd); DataSet ds1; fd.action = "SelectPrdName"; ds1 = fd.LoadProductName(fd); #endregion DataColumn dcol1 = new DataColumn("ProductName/Product_Types"); dt.Columns.Add(dcol1); //Create an ID column for adding to the Datatable for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataColumn dcol = new DataColumn((ds.Tables[0].Rows[i]["pack_name"].ToString()), typeof(System.String)); // dcol.AutoIncrement = true; dt.Columns.Add(dcol); } DataColumn dco2 = new DataColumn("Total_Prise"); dt.Columns.Add(dco2); //Create an ID column for adding to the Datatable // dcol = new DataColumn(NAME, typeof(System.String)); // dt.Columns.Add(dcol); //Now add data for dynamic columns //As the first column is auto-increment, we do not have to add any thing. //Let's add some data to the second column. //Create a new row for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { DataRow drow = dt.NewRow(); drow[ProductName_Product_Types] = ds1.Tables[0].Rows[i][0].ToString(); dt.Rows.Add(drow); } //Initialize the row data. // drow[ds.Tables[0].Rows[0]["pack_name"].ToString()] = 0; //Add the row to the datatable. // dt.Rows.Add(drow); #endregion //Iterate through the columns of the datatable to set the data bound field dynamically. foreach (DataColumn col in dt.Columns) { BoundField bfield = new BoundField(); bfield.DataField = col.ColumnName; //Initialize the HeaderText field value. bfield.HeaderText = col.ColumnName; //Add the newly created bound field to the GridView. grd_DSR.Columns.Add(bfield); } //Initialize the DataSource grd_DSR.DataSource = dt; grd_DSR.DataBind(); } i just want textboxes in cells when i clicked on button which is outside the textbox.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)