根据视口更改边界字段可见状态
我有一个带有许多边界字段的网格视图。我正在尝试使某些边界字段可见或不可见,具体取决于屏幕的宽度。我到处都看过,并且尝试了 visible="<%=javascript:widthFunction()%>"
,
function widthFunction(){
viewportWidth = window.innerWidth;
if(viewportWidth > "500")
return true;
else {return false;}
显然这不起作用。我尝试将类似的代码放在我的代码后面,但这需要 DataBind 的东西,这是行不通的,因为
解析器错误消息:数据绑定表达式仅在具有以下属性的对象上受支持 数据绑定事件。 System.Web.UI.WebControls.BoundField 没有 DataBinding 事件。
如何解决这个问题?
I have a gridview with a number of boundfields. I'm trying to make it so that some boundfields are visible or invisible depending on the width of the screen. I've looked everywhere, and i tried visible="<%=javascript:widthFunction()%>"
where
function widthFunction(){
viewportWidth = window.innerWidth;
if(viewportWidth > "500")
return true;
else {return false;}
Clearly that's not working. I tried putting similar code in my code behind, but that requires the DataBind thing, which that won't work because
Parser Error Message: Databinding expressions are only supported on objects that have
a DataBinding event. System.Web.UI.WebControls.BoundField does not have a DataBinding
event.
How can this be solved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论