These code for Textbox of gridview can't be blank while upadating record.

Introduction
These code is helpful While inserting or updating records in gridview you need following exception for avoiding blank records.You can see it in above image.
Write following codes for it
<
style type="text/css">
.error
{
display:block;
color:red;
font:bold 16px Arial;
margin:10px;
}
</
style>
<
asp:Label ID="lblError"
EnableViewState="false"
CssClass="error"
runat="Server" />
<asp:GridView
id="grdMovies"
DataKeyNames="Id"
AutoGenerateEditButton="true"
DataSourceID="srcMovies"
runat="Server" OnRowUpdated="grdMovies_RowUpdated" />
<asp:SqlDataSource ID="srcMovies"
SelectCommand="select id,title from movies"
UpdateCommand="update movies set title=@title where id=@id"
ConnectionString="Your string"
runat="server" ProviderName="System.Data.SqlClient" />
protected
void grdMovies_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
if (e.Exception != null)
{
lblError.Text =
"Can't be blank";
e.ExceptionHandled =
true;
}
}