0

我尝试将我的 gridview 列 IsActive(布尔类型)传递给我的视图表单。

GridView / DataTable 列名:IsActive (d_Boolean(char1))

表单检查编辑名称:chkIsActive

以下是表格代码

public partial class PayrollBBNationalForm : DevExpress.XtraEditors.XtraForm
{
    private BCE.Data.DBSetting mydbset_form1;
    private DataTable tableMaster_form1;
    private int row_form1;
    private string mode_form1;
    private GridView gridView1_form1;

    public PayrollBBNationalForm(BCE.Data.DBSetting mydbset, DataTable tableMaster, GridView gridView1, String mode, int row)
    {
        /// Initialize Values from Master WinForm
        mydbset_form1 = mydbset;
        tableMaster_form1 = tableMaster;
        gridView1_form1 = gridView1;
        mode_form1 = mode;
        row_form1 = row; 

        InitializeComponent();
        this.Load += Form_Load;
    }
    #region Load Form Data
    private void Form_Load(object sender, EventArgs e)
    {
        textNationalCode.Text = gridView1_form1.GetFocusedRowCellValue("NationalCode").ToString();
        textNationalCountry.Text = gridView1_form1.GetFocusedRowCellValue("NationalCountry").ToString();
        textGovermentCode.Text = gridView1_form1.GetFocusedRowCellValue("GovermentCode") != null ? gridView1_form1.GetFocusedRowCellValue("GovermentCode").ToString() : "";
        textRemarks.Text = gridView1_form1.GetFocusedRowCellValue("Remarks").ToString();
        memoNote.Text = gridView1_form1.GetFocusedRowCellValue("Note").ToString();

        chkIsActive = /// I stuck at here. This unable to pass gridView1_form1.GetFocusedRowCellValue("IsActive");

    }
    #endregion

}

在此处输入图像描述

4

1 回答 1

0

我解决了这个问题,我发现错过了什么。将此 gridView1_form1.GetFocusedRowCellValue("IsActive").ToString() 从文本转换为布尔值。

之后每一项工作都OK。

于 2017-02-20T08:53:29.087 回答