首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >回发不刷新testbox或gridview的内容

回发不刷新testbox或gridview的内容
EN

Stack Overflow用户
提问于 2011-08-03 18:43:40
回答 1查看 656关注 0票数 0

我真的需要帮助。我正在使用AjaxControlToolkit.TabContainerASP.NET Framework 4.0。Gridview、textbox和按钮被放置在asp页面的TabContainer中。当我按下按钮回发时,它不会将网格视图绑定到datatable和textbox内容也不会被更新。

我调试代码,并发现当我按下按钮回发时确实会发生,而内容确实填充在网格视图和textbox值中,并且还分配了新的值。但是值不会显示在页面上。我不知道为什么会这样。请帮帮忙。

代码语言:javascript
复制
protected void Page_Load(object sender, EventArgs e)
{
  if (IsPostBack)
  {
      if (ListBoxCustomer.Items.Count != 0)
      {
          int[] _selectedItems = ListBoxCustomer.GetSelectedIndices();
          string _comma = "";
          string _custID = "";
          InitializeConnection();
          if (_selectedItems.Length != 0)
          {
              foreach (int i in _selectedItems)
              {
                  _custID = _custID + _comma + ListBoxCustomer.Items[i].Value;
                  _comma = ",";
              }
              if (custObj != null)
              {
                  //DataTable _dt = new DataTable();
                  DataSet _ds = new DataSet();
                  GridViewCustomer.Visible = true;
                  GridViewCustomer.AutoGenerateColumns = true;
                  _ds = custObj.GetSelectedCustomers(1, _custID);
                  GridViewCustomer.DataSource = _ds.Tables[0];
                  GridViewCustomer.DataBind();

                  TextBoxTest.Text = GridViewCustomer.Rows.Count.ToString();
                  TextBoxTest.Text = "test";
              }
          }
      }
  }
}

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2011-08-03 18:54:58

也许DataBind代码是永远无法到达的。您是否设置了一些断点以确保if-语句没有阻塞您?那是..。ListBoxCustomer.Items.Count 绝对不是零..。custObj 肯定不为空吗?

您在哪里为custObj赋值?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6931560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档