lblID.DataBinding += new EventHandler(this.BindID);
这一行里把this去掉改成lblID.DataBinding += new EventHandler(BindID);试试
这一行里把this去掉改成lblID.DataBinding += new EventHandler(BindID);试试
解决方案 »
- 如何计算 中间值 呢?
- 如何进行vs2010的winform程序带有Service-based database的应用程序部署
- 如何将数据缓存以便于频繁读取?!
- ToDateTime出错?!!
- ZengHD你在哪里 求教:改变listview virtualmodel下 子项的位置
- 类型转换问题(时时等待,秒秒刷新)
- 请教下用OleDb怎么访问Sql 2000数据库表的primary key?
- 启动exe程序问题
- 大伙帮我看看这个API的调用,GetCursorPos!
- 这是为什么?我是在本机使用的,当我对一个文件进行打开操作时发生错误?
- 拼写与语法检查(类Word功能),如何实现?
- c#菜鸟提问,关于COM口通信和TCP协议的
["DLID"].ToString();
我的Datagrid读取的是SqlDataReader
如何处理?
private void DataBinding(object sender, EventArgs e)
{
try
{
Label l = (Label) sender;
DataGridItem container = (DataGridItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)["classname"].ToString();
}
catch (Exception caught)
{
string ss = caught.Message;
ss = "";
}
}
Label l = (Label) sender;这个代码报错,错误信息:"指定的转换无效。"
请问这么解决???
应该是用Literal类型
但如果DataGraid里面是TextBox的 怎么样把数据库的内容绑定到TextBox呢