I m doing Invoice Project For My student..
When customer buying 3 kinds of products (pencils,bags,Cd’s), I saved these records in 3 rows with Unique Customer
My Invoice table having the following columns.. InvoiceId,CustomerID,ProductName,ProductPrice,Quantity,Total,InvoiceAmount.
When I going to update this Invoice I have some problem..so I post here..
I shows those 3 rocords in gridview with autoedit,delete buttons =true…
In Gridview I shows , 1st column is ProductName,2nd column is Quantity, 3rd Column in Price, 4th Column in Total Amount..
I used template columns in my gridview….when I click any row of edit button I want to show ProductNames in DropDownlist(normally it comes with text box..i don’t want textbox),then If I select any productname from 1st column of dropdownlist , the corresponding product price will be coming in 3rd column of Price TextBox and if I change quantity in my 2nd column of Textbox , the total amount(quantity *Price=totalamt) will be calculated and display in 4th column of Text box..finally when I click update button , the update value will be stored in database..all the works with in the gridview control…
abhishek trivediPosted Jan 23, 2009, 12:31 AM
hi!
first of all you have to place dropdown control in your template and make that column visible = false.
and on your edit button item command event fill that drodown list and make that column visible. make autopostback = true for that dropdown and change the price value depend upon the product selected in the dropdown list. and you can also write code if u want to make total in your last textbox on text_changed event for the Price textbox.
and finally click on the update button, take all the values from the all controls and update it.
I hope this will help you,