如何将TextBox绑定到数据源
问题描述:
我想将文本框绑定到数据源,以便我可以实现IDataErrorInfo。如何将TextBox绑定到数据源
我将如何实现,基本上做什么
TextBoxClientRenewalDate.DataSource = contract.RenewalDate;
会做的功能,如果它存在。
答
我真的不知道你要找什么,但通常你会值只是分配给Text
财产,像这样:
TextBox1.Text = MyDataTable.Rows[0].Field<string>("SomeColumn");
我想你可以使用DataBinder
对象太:
//not positive here, but it should be close
TextBox1.Text = (string)DataBinder.Eval(MyDataTable, "SomeColumn");