开发者

postback doesnt refresh contents of testbox or gridview

I realy need help for this. I am using AjaxControlToolkit.TabContainer and using ASP.NET Framework 4.0. Gridview,textbox and button are placed in TabContainer on asp page. When I press button postback does happen but its not binding gridview to datatable and textbox contents are also not updated.

I debug the code and found when i press button postback does happen and content does fill up in gridview and textbox value also assigned with new value. but values doesnt display on the page. I dont know why its happening. please help.

protected void Page_Load(object sender, EventArgs e)
{
  if (IsPostBack)
  {
      if (ListBoxCustomer.Items.Count != 0)
      {
          int[] _selectedItems = ListBoxCus开发者_运维技巧tomer.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";
              }
          }
      }
  }
}

thanks.


Perhaps the DataBind code is never being reached. Have you set some breakpoints to make sure the if-statements aren't blocking you? That is... Is ListBoxCustomer.Items.Count definitely not zero... Is custObj definitely not null?

Where do you assign a value to custObj?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜