Server Error in '/' Application.
Conversion from type 'DBNull' to type 'Boolean' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.
Source Error:
Line 102: </EditItemTemplate>
Line 103: <ItemTemplate>
Line 104: <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Cases") %>' Enabled="false" />
Line 105: </ItemTemplate>
Line 106: </asp:TemplateField>
Source File: C:\Users\Makumbi\source\repos\INTERVIEWSVB\INTERVIEWSVB\Forms\Casestudents.aspx Line: 104
Stack Trace:
[InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions.ToBoolean(Object Value) +1314924
ASP.forms_casestudents_aspx.__DataBinding__control40(Object sender, EventArgs e) in C:\Users\Makumbi\source\repos\INTERVIEWSVB\INTERVIEWSVB\Forms\Casestudents.aspx:104
System.Web.UI.Control.OnDataBinding(EventArgs e) +86
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +154
System.Web.UI.Control.DataBind() +17
System.Web.UI.Control.DataBindChildren() +187
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +164
System.Web.UI.Control.DataBind() +17
System.Web.UI.Control.DataBindChildren() +187
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +164
System.Web.UI.Control.DataBind() +17
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +170
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3839
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +15
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +133
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +151
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +76
System.Web.UI.WebControls.GridView.DataBind() +10
INTERVIEWSVB.Casestudents.Button2_Click(Object sender, EventArgs e) in C:\Users\Makumbi\source\repos\INTERVIEWSVB\INTERVIEWSVB\Forms\Casestudents.aspx.vb:41
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9796242
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +211
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1696
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4465.0
<asp:GridView ID="Studentgrid" runat="server" ItemStyle-Width="Auto" AutoGenerateColumns="False">
<Columns>
<asp:CommandField HeaderText="Edit Record" ShowHeader="True" ShowSelectButton="True" />
<asp:BoundField DataField="admno" HeaderText="Admno" ReadOnly="True" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" />
<asp:BoundField DataField="Stream" HeaderText="Stream" SortExpression="Stream" />
<asp:BoundField DataField="Category" HeaderText="Category" SortExpression="Category" />
<asp:BoundField DataField="Intake" HeaderText="Intake" SortExpression="Intake" />
<asp:BoundField DataField="comment" HeaderText="Comment" />
<asp:TemplateField>
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Cases") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Cases") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>