I have detail view in asp.net from which i am inserting data to DB.Here i want to check before insert if any field is null or not and if null then don't insert otherwise insert into db i have tried the following code but it doesn't working
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
string unt = (string)e.Values["UNT_COD"];
if (unt == "")
{
e.Cancel = true;
}
}
Through this code i am not achieving my purpose plz any one help me to find out the way to check
string unt = e.Values["UNT_COD"]+"";
if (unt == "")
{
e.Cancel = true;
}