Reputation: 3896
How can I manually add row/insert into DB with a gridview control?
I need to perform some calculations on the user input first before sending the data to the INSERT sql query.
There is a gridview.Insert()
method but it does not take any parameters.
How can I pass it my parameters, which come from textboxes, dropdownlists, etc and then run the sql query?
Upvotes: 2
Views: 1099
Reputation: 698
Try to add it in datatable before binding it:
DataRow dr = dt.NewRow();
// set dr fields here
dt.Rows.Add(dr);
Upvotes: 1