【问题标题】:Using SQL DataSource使用 SQL 数据源
【发布时间】:2023-03-20 17:02:01
【问题描述】:

我在网页中有一个 SQL 数据源和一个数据网格。加载页面时,数据网格会自动绑定。如何将其延迟到按钮的单击事件。

【问题讨论】:

  • @AmenAyach 如果我想通过单击另一个按钮断开绑定,我该怎么办。

标签: asp.net .net vb.net data-binding gridview


【解决方案1】:

在 ButtonToBindclick 事件中

  • System.Web.HttpContext.Current.Session("BindUnbind")="b"
  • response.redirect("Mypage.aspx")

在 ButtonToUnBindclick 事件中

  • System.Web.HttpContext.Current.Session("BindUnbind")="u"
  • response.redirect("Mypage.aspx")

*在页面加载中*

如果 System.Web.HttpContext.Current.Session("BindUnbind")="b" 那么

  • 绑定网格

elseif System.Web.HttpContext.Current.Session("BindUnbind")="u" 然后

  • 取消绑定网格

结束

System.Web.HttpContext.Current.Session("BindUnbind")=""

【讨论】:

    猜你喜欢
    • 2011-12-15
    • 1970-01-01
    • 1970-01-01
    • 2022-11-17
    • 2014-01-28
    • 2013-08-16
    • 2013-03-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多