<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"> <ContentTemplate> <table align=center cellpadding="200px"> <caption> <label> Select Regular Sheesha</label> <tr> <td> <asp:DropDownList ID="Drop_nsheesha" runat="server" > </asp:DropDownList> </td> <td> <asp:Label ID="Label3" runat="server" Text="Quantity"></asp:Label> </td> <td> <asp:TextBox ID="TextBox_SimpleSheesha" runat="server" width="30px" /> </td> <caption> <br /> <tr> <td> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">ADD</asp:LinkButton> </td> </tr> </caption> </tr> </caption> </table> <asp:GridView ID="GridView2" runat="server" > </asp:GridView> </ContentTemplate> </asp:UpdatePanel>
DataTable temp = new DataTable(); protected void Page_Load(object sender, EventArgs e) { temp.Columns.Add("Sheesha"); temp.Columns.Add("Quantity"); } protected void LinkButton1_Click(object sender, EventArgs e) { temp.Rows.Add(); temp.Rows[temp.Rows.Count - 1]["Sheesha"] = Drop_nsheesha.SelectedItem; temp.Rows[temp.Rows.Count - 1]["Quantity"] = TextBox_SimpleSheesha.Text; GridView2.DataSource = temp; GridView2.DataBind(); } ("Quantity"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)