我尝试将gridview列IsActive(布尔类型)传递给我的视图表单。
GridView / DataTable列名:IsActive(d_Boolean(char1))
表单CheckEdit名称: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
}
答案 0 :(得分:0)
我解决了这个问题,我发现了什么错过了。将此gridView1_form1.GetFocusedRowCellValue(" IsActive")。ToString()从Text转换为Boolean。
之后每项工作都行。