Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Value for an unbound checkbox field must be of type bool or bool?, not type System.String WebDataGrid
posted

I have WebDataGrid which needs to be update /Refresh while Change Value from Upper Portion of the Page. I have Some Bounded Fields and one ids the UnBounded Field. SomeTiimes it Works Fine but Sometine it Give me Error 'Value of an unBound Checkbox Field must be of Type of Bool'. I Have Set the Default Value but Getting the Same Error. My Front End Side Is :

<td align="center">
<igtbl:WebDataGrid ID="grdPay" runat="server" Height="400px" TabIndex="4"
DataKeyFields="PARTICIPANT_ID"
StyleSetName="Office2007Blue" EnableDataViewState="true" ViewStateMode="Enabled" BorderColor="#000066" BorderStyle="Ridge" AutoGenerateColumns="False" Width="780px">
<Columns>
<igtbl:UnboundCheckBoxField Key="All_Checkbox" VisibleIndex="0" Header-Text="" HeaderChecked="true"
Width="20px">
</igtbl:UnboundCheckBoxField>
<igtbl:BoundDataField DataFieldName="TRANSACTION_DATE" Key="TRANSACTION_DATE"
Hidden="True" DataType="System.DateTime" Width="120px" VisibleIndex="1">
<Header Text="Transaction Date" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="PARTICIPANT_CODE" Key="PARTICIPANT_CODE"
DataType="System.DateTime" Width="120px" VisibleIndex="2">
<Header Text="Participant" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="BANK_NAME" Key="BANK_NAME"
DataType="System.DateTime" Width="60px" VisibleIndex="3">
<Header Text="Bank Name" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="BANK_CODE" Key="BANK_CODE"
DataType="System.DateTime" Width="60px" VisibleIndex="4">
<Header Text="Bank Code" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="BRANCH_NAME" Key="BRANCH_NAME"
DataType="System.DateTime" Width="100px" VisibleIndex="5">
<Header Text="Branch Name" />
</igtbl:BoundDataField>

<igtbl:BoundDataField DataFieldName="STATUS" DataType="System.String"
VisibleIndex="6" Key="STATUS" Width="50px">
<Header Text="Status" >

</Header>
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="AMOUNT" Key="AMOUNT"
DataFormatString="{0:N4}"
DataType="System.Decimal" Width="80px" VisibleIndex="7">
<Header Text="Amount" />
</igtbl:BoundDataField>


<igtbl:BoundCheckBoxField DataFieldName="Manually_Settle" DataType="System.Boolean"
VisibleIndex="8" Key="Manually_Settle" Width="80px">
<Header Text="Manually Settle" >

</Header>
</igtbl:BoundCheckBoxField>
<igtbl:BoundCheckBoxField DataFieldName="POST" DataType="System.Boolean"
Width="50px" VisibleIndex="9" Key="POST" >
<Header Text="Post" >

</Header>
</igtbl:BoundCheckBoxField>

<igtbl:BoundDataField DataFieldName="COUPON_PAYMENT_DATE" Key="COUPON_PAYMENT_DATE"
VisibleIndex="10" DataType="System.DateTime" Width="100px" Hidden="true" >
<Header Text="COUPON PAYMENT DATE" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="BANK_ID" Key="BANK_ID"
VisibleIndex="11" DataType="System.DateTime" Width="100px" Hidden="true" >
<Header Text="BANK ID" />
</igtbl:BoundDataField>
<igtbl:BoundDataField DataFieldName="BRANCH_ID" Key="BRANCH_ID"
VisibleIndex="12" DataType="System.DateTime" Width="100px" Hidden="true" >
<Header Text="BRANCH ID" />
</igtbl:BoundDataField>

<igtbl:BoundDataField DataFieldName="PARTICIPANT_ID" Key="PARTICIPANT_ID"
Hidden="True" DataType="System.String" Width="120px" VisibleIndex="13">
<Header Text="PARTICIPANT ID" />
</igtbl:BoundDataField>

</Columns>
<Behaviors>
<igtbl:EditingCore>
<Behaviors>
<igtbl:CellEditing>
<ColumnSettings>
<igtbl:EditingColumnSetting ColumnKey="AMOUNT" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="BANK_NAME" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="BANK_CODE" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="BRANCH_NAME" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="STATUS" ReadOnly="false" />
<igtbl:EditingColumnSetting ColumnKey="POST" ReadOnly="false" />
<igtbl:EditingColumnSetting ColumnKey="TRANSACTION_DATE" ReadOnly="True" />
<igtbl:EditingColumnSetting ColumnKey="PARTICIPANT_CODE" ReadOnly="True" />
<igtbl:EditingColumnSetting ColumnKey="NAME" ReadOnly="True" />
<igtbl:EditingColumnSetting ColumnKey="SETTLEMENT_DATE" ReadOnly="True" />
<igtbl:EditingColumnSetting ColumnKey="CLEARING_ID" ReadOnly="True" />
</ColumnSettings>
</igtbl:CellEditing>
</Behaviors>

</igtbl:EditingCore>
<igtbl:RowSelectors>
</igtbl:RowSelectors>
</Behaviors>
</igtbl:WebDataGrid>
</td>
<td>
</td>
</tr>

and BackEnd Side Code :

public void DataBindGrid()
{
Decimal TotalPayments = 0;
DataTable DT = new DataTable();
DataTable DT2 = new DataTable();
bool IsallChecked = true;

DT = LoadData();
//grdPay.DataSource = DT;
//grdPay.DataBind();
DT2.Columns.Add("All_Checkbox");
DT2.Columns.Add("PARTICIPANT_ID");
DT2.Columns.Add("TRANSACTION_DATE");
DT2.Columns.Add("PARTICIPANT_CODE");
DT2.Columns.Add("BANK_NAME");
DT2.Columns.Add("BANK_CODE");
DT2.Columns.Add("BRANCH_NAME");
// DT2.Columns.Add("NAME");
DT2.Columns.Add("AMOUNT");
DT2.Columns.Add("STATUS");
DT2.Columns.Add("Manually_Settle");
DT2.Columns.Add("POST");
DT2.Columns.Add("COUPON_PAYMENT_DATE");
DT2.Columns.Add("BANK_ID");
DT2.Columns.Add("BRANCH_ID");


if (DT != null)
{
grdPay.Rows.Clear();

for (int i = 0; i < DT.Rows.Count; i++)
{

//grdPay.Rows.add();
var row = DT2.NewRow();
row["All_Checkbox"] = true;
row["TRANSACTION_DATE"] = null;
row["PARTICIPANT_ID"] = Convert.ToInt32(DT.Rows[i]["PARTICIPANT_ID"]);
row["PARTICIPANT_CODE"] = Convert.ToString(DT.Rows[i]["PARTICIPANT_CODE"]);
row["BANK_NAME"] = Convert.ToString(DT.Rows[i]["BANK_NAME"]);
row["BANK_CODE"] = Convert.ToString(DT.Rows[i]["BANK_CODE"]);
row["BRANCH_NAME"] = Convert.ToString(DT.Rows[i]["BRANCH_NAME"]);
row["STATUS"] = Convert.ToString(DT.Rows[i]["STATUS"]);
TotalPayments += chkDigit * Convert.ToDecimal(DT.Rows[i]["AMOUNT"]);
if (!Convert.IsDBNull(DT.Rows[i]["IS_MANUAL"]))
{
row["Manually_Settle"] = (Convert.ToInt32(DT.Rows[i]["IS_MANUAL"])) == 0 ? false : true;
}
else
{
row["Manually_Settle"] = false;
}

row["BANK_ID"] = Convert.ToInt32(DT.Rows[i]["BANK_ID"]);
row["BRANCH_ID"] = Convert.ToInt32(DT.Rows[i]["BRANCH_ID"]);
DT2.Rows.Add(row);
DT2.AcceptChanges();
}
txtDuePayment.Value = TotalPayments;

grdPay.DataSource = DT2;
grdPay.DataBind();
}
else
{
grdPay.DataSource = null;
grdPay.DataBind();
}

if (IsallChecked == true && RadioButtonList1.SelectedValue == "S")
chkAllStatus.Checked = true;
}

Parents Reply Children
No Data