asp.net - Add rows in grid view dynamically -
I have a grid view that is used to show product details. Another thing is that there is a table that means ProductMaster Data from Gridview is coming from this table. Now what I want to do is, for the first time when the page loads, only the first column should be filled in, which lists the product name dropdowns. All other rows should be empty. Now when the user selects the item from the dropdown list, then the other column should be filled with trustworthy and the other blank line should appear across the bottom line whenever the page loads, there will be only one blank row (first column dropdown) List will be filled with products)
How can I get this work done ??????
Check out this article:
aspx: Behind the code: dropdown list < / Code> Add inside
TemplateColumn and
OnRowDataBound event fill it with product names and instead click
click with the
button As mentioned in the incident, you have to handle
by changing the selected index event
dropdownlist , referenced on the line in which it has the
DropDownList and Fill in the other columns of the row.
& lt; Columns & gt; & Lt; ASP: TemplateField & gt; & Lt; ItemTemplate & gt; & Lt; ASP: Dropdown List ID = "CMP Product" Runat = "Server" On-Select Index Changed = "CMP Product_Handed" AutoPostback = "True" & gt; & Lt; / ASP: DropDownList & gt; & Lt; / ItemTemplate & gt; ... & lt; / Column & gt;
Secure Zero cmbProduct_Changed (Object Sender, EventArgs e) {DropDownList cmbProduct = (DropDownList) Sender; GridViewRu Perrentro = (GridViewerw) cmbProduct.NamingContainer; Selected stringproded = cmbProduct.SelectedValue; / * Get product details & amp; Other columns / control binds with product details * / labeled lbl = (label) parentRow.FindControl ("lblProductName"); Lbl.Text = "...."; / * Call addNewRowToGrid explaied in the article / / AddNewRowToGrid (); }
Comments
Post a Comment