DataTable dtdcDetails = new DataTable(); objRetailPL.sno = Convert.ToInt32(dtdate.Rows[i]["sno"].ToString()); dtdcDetails = objRetailBAL.dtdateTallyTable(objRetailPL); GridView gv = new GridView(); //gv.ID = "gv" + dtdate.Rows[i]["BranchDate"].ToString(); gv.Width = 600; Label lblTotal = new Label(); Label lbltotaleggs = new Label(); BoundField partyname = new BoundField(); partyname.HeaderText = "PartyName"; partyname.DataField = "partyname"; gv.Columns.Add(partyname); BoundField birdtype = new BoundField(); birdtype.HeaderText = "Bird Type"; birdtype.DataField = "birdname"; gv.Columns.Add(birdtype); BoundField totweight = new BoundField(); totweight.HeaderText = "Total Weight"; totweight.DataField = "totalweight"; gv.Columns.Add(totweight); BoundField rateperkg = new BoundField(); rateperkg.HeaderText = "Rate/Kg"; rateperkg.DataField = "rateperkg"; gv.Columns.Add(rateperkg); BoundField Bdcno = new BoundField(); Bdcno.HeaderText = "DCNo"; Bdcno.DataField = "dcno"; gv.Columns.Add(Bdcno); ButtonField btn = new ButtonField(); //Initalize the DataField value. btn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; btn.CommandName = "Button"; btn.ButtonType = ButtonType.Button; btn.Text = "Confirm"; btn.Visible = true; gv.Columns.Add(btn); gv.AutoGenerateColumns = false; gv.ShowFooter = true; gv.DataSource = dtdcDetails; gv.DataBind();
void gv_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Button")) { // your code here } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)