与Asp.net SqlDataSource绑定到数据库的问题 [英] problem with binding to DB with Asp.net SqlDataSource

查看:94
本文介绍了与Asp.net SqlDataSource绑定到数据库的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我打算使用sqldatasource绑定到我的RadioButton的数据库,
但是在绑定完成之后,每当我调试解决方案时,都会出现此异常:

诸如Eval(),XPath()和Bind()之类的数据绑定方法只能在数据绑定控件的上下文中使用.

是什么问题?

hi.
i intend to use sqldatasource to bind to DB for my RadioButton,
but after binding completed , whenever i debug the solution this exception appeares:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

what is the problem?

推荐答案

使用
<%#DataBinder.Eval(Container.DataItem,"value") %>''


插入Eval("value")


Insted of Eval("value")


因为单选按钮不是数据绑定控件.如果要绑定sqldatasource,则应使用Radiobuttonlist.



请投票对您有帮助
Because radio button is not a databound control. you should use Radiobuttonlist if you want to bind sqldatasource.



Please Vote if it helps you


这篇关于与Asp.net SqlDataSource绑定到数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆