sd_dracula
sd_dracula

Reputation: 3896

asp.net manually adding a row from codebehind

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

Answers (1)

Eugene Pavlov
Eugene Pavlov

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

Related Questions