2014年7月13日 星期日

[RESOLVED] Gridview - cannot get one column to be editable


Hi,


I have a web page that is an order form. I want the user to be able to change the quantities of each product in the gridview and then click on the submit button to update the order. I have a list of products in the gridview but I can't get the quantity to
be editable. What am I doing wrong?


Here is the code....




































Thanks for the help!


Gary



Try with ItemTemplate:











Thanks urenjoy that worked.


I'm wondering why EditItemTemplate wouldn't work? Isn't that what it's for?



In GridView, you able to edit single row only. To make a row editable, you need button with CommandName ="edit" or use CommandField to show edit button. When you click the button, current row become editable. If you want display textbox in all rows, place the
textbox in ItemTemplate, use button with CommandName ="whatevername" then use GridView RowCommand event. Get rowindex from e.CommandArgument value to update the row manually. Or use button outside GridView to update all rows by looping.

沒有留言:

張貼留言