Avoid getting NULL value

if(!IsPostBack){

//code here

}

Anuncios

Check if value from SqlDataReader is null

TextBox1.Text = reader.IsDBNull(1) == true ? “” : reader.GetDecimal(1).ToString();

Clear GridView

GridView1.DataSource = null;

GridView1.DataBind();