Hi,
Plzz look at the code below:
if (menuType == "city")
{
DataSet DSLoadMaster = obj.LoadDataSet("Select * from city_master");
// Here we'll add a blank row to the returned DataTable
DataTable DT = DSLoadMaster.Tables[0];
DataRow DR = DT.NewRow();
DT.Rows.InsertAt(DR,0);
//Creating the first row of GridView to be Editable
GVDetails.EditIndex = 0;
GVDetails.DataSource = DT;
GVDetails.DataBind();
}
i am trying to insert a new row in gridview which has dynamically created bound fields. I get an error cityname doe not allow null values..
ColumnName does not allow nulls
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Pravin MoreRank #1,419 · 1.2K reputationPosted Aug 24, 2011, 2:51 AM EDT
your code is correct.error might be because of table column constraints.that column is not allowing null value.
Suthish NairRank #92 · 22.8K reputationPosted Aug 24, 2011, 2:51 AM EDT