<div class="field"><asp:Table ID="tblquotation" runat="server" CssClass="mGrid"> </asp:Table></div>
int count = Convert.ToInt32(ViewState["Product"].ToString()); for (int i = 0; i <= count; i++) { if (i == 0) { TableHeaderRow tr = new TableHeaderRow(); //TableRow tr = new TableRow(); TableHeaderCell tc1 = new TableHeaderCell(); tc1.Text = "S.No."; tr.Cells.Add(tc1); TableHeaderCell tc2 = new TableHeaderCell(); tc2.Text = "GroupName"; tr.Cells.Add(tc2); TableHeaderCell tc3 = new TableHeaderCell(); tc3.Text = "Name"; tr.Cells.Add(tc3); tblquotation.Controls.Add(tr); } else { TableRow tr = new TableRow(); TableCell tc1 = new TableCell(); tc1.Text = i.ToString(); tc1.HorizontalAlign = HorizontalAlign.Center; tr.Cells.Add(tc1); TableCell tc2 = new TableCell(); //TextBox txtbasic = new TextBox(); DropDownList txtbasic = new DropDownList(); SqlDataReader dr = commonfunctions.ExecuteQueryReturnDataReader("sp_Group_Purchase"); if (dr.HasRows) { txtbasic.DataTextField = "GroupName"; txtbasic.DataValueField = "GId"; txtbasic.DataSource = dr; txtbasic.DataBind(); } txtbasic.Items.Insert(0, "<--Select-->"); txtbasic.ID = "txtbasic" + i.ToString(); txtbasic.AutoPostBack = true; txtbasic.SelectedIndexChanged += txtbasic_SelectedIndexChanged; tc2.Controls.Add(txtbasic); tc2.HorizontalAlign = HorizontalAlign.Center; tr.Cells.Add(tc2); TableCell tc3 = new TableCell(); //TextBox txtbasic = new TextBox(); DropDownList ddlName = new DropDownList(); SqlDataReader dr4 = commonfunctions.ExecuteQueryReturnDataReader("sp_Itemname_Purchase"); if (dr4.HasRows) { ddlName.DataTextField = "ItemName"; ddlName.DataValueField = "ItemId"; ddlName.DataSource = dr4; ddlName.DataBind(); } ddlName.Items.Insert(0, "<--Select-->"); ddlName.ID = "ddlName" + i.ToString(); // txtbasic.Attributes.Add("onkeypress", "return isNumberKey(event);"); tc3.Controls.Add(ddlName); tc3.HorizontalAlign = HorizontalAlign.Center; tr.Cells.Add(tc3); tblquotation.Controls.Add(tr); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)