这是我的模特。
FrmProcessOrder _FrmProcessOrder;
public FrmSelection()
{
InitializeComponent();
LoadData();
}
//Method which reads data from the db and laod data on listview
public void LoadData()
{
_connection = "Data Source=MILESTONE-PC;Initial Catalog=Jack;Integrated Security=True";
_sql = "Select * from tblJackon";
_conn = new SqlConnection(_connection);
_conn.Open();
_comm = new SqlCommand(_sql, _conn);
_adapt.SelectCommand = _comm;
_adapt.Fill(_dataset, _sql);
DataTable _tbl = _dataset.Tables[0];
_dtrow = null;
foreach (DataRow _dataVariable in _tbl.Rows)
{
_dtrow = _dataVariable;
ListBoxSelection.Items.Add((_dtrow["FormNames"]));
}
}
private void btnAddForms_Click(object sender, EventArgs e)
{
_FrmProcessOrder.AddList(ListBoxSelection); // It throws error on this line after select from listbox so that the item must to FrmProcessOrder listbox
_FrmProcessOrder = new FrmProcessOrder();
}
我想将ScreenName绑定到控件的复选框。在db我有数据。我想绑定。 我改变了这样的事情
这是控制器代码。
public partial class Tm_Screen
{
public int Screen_Id { get; set; }
public string Screen_name { get; set; }
public string Screen_Desc { get; set; }
public string IsActive { get; set; }
}
这是观看代码
var list = new List<tm_scrn_screen>
{
new tm_scrn_screen{scrn_name="csscs",scrn_isactive=true}
};
return View( list);
这不起作用。 一些红色标记接近m =&gt;米[I] .scrn_name