日期:2014-05-20  浏览次数:21096 次

关于TreeView和UpdatePanel通信的问题?
页面:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TreeView ID="TreeView1" runat="server" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" ImageSet="Msdn">
</asp:TreeView>

<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional" EnableViewState="false">
  <ContentTemplate>
  <XrxContrls:Vlist ID="listVideo" runat="server" EnableViewState="false"/>  
  </ContentTemplate>
  <Triggers>
  <asp:AsyncPostBackTrigger ControlID="TreeView1" EventName="SelectedNodeChanged"/>
  </Triggers>
  </asp:UpdatePanel> 
后台:
  protected void Page_Load(object sender, EventArgs e)
  {  
  //自定义控件设置
  listVideo.Columnid = Convert.ToInt32(Request.QueryString["ColumnId"]);
  listVideo.columnidstr = 8;
  listVideo.dateformat = "yy-MM-dd";
  listVideo.pageSize = 7;  
  if (!IsPostBack)
  {
  BindTrees(0, (TreeNode)null);
  }
  }
  private void BindTrees(int ParentID, TreeNode pNode)
  {
  IColumn cl = new Column();
  IList<ColumnInfo> clist = new List<ColumnInfo>();
  clist = cl.GetColumnByList(ParentID);
  //一级节点
  for (int i = 0; i < clist.Count; i++)
  {
  TreeNode tnc = new TreeNode(clist[i].Caption.ToString());
  if (pNode == null)
  {
  TreeView1.Nodes.Add(tnc);
  tnc.Value = clist[i].ColumnId.ToString();
  tnc.Expanded = false;
  tnc.SelectAction = TreeNodeSelectAction.Select;
   
  BindTrees(Convert.ToInt32(clist[i].ColumnId), tnc);
  }
  else
  {
  pNode.ChildNodes.Add(tnc);
  tnc.Value = clist[i].ColumnId.ToString();
  tnc.Expanded = true;
  tnc.SelectAction = TreeNodeSelectAction.Select;

  BindTrees(Convert.ToInt32(clist[i].ColumnId), tnc);
  }
  }
  }
  protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
  {
  if (TreeView1.SelectedValue!="")
  {
  //自定义控件设置
  listVideo.Columnid = Convert.ToInt32(TreeView1.SelectedValue);
  listVideo.columnidstr = 8;
  listVideo.dateformat = "yy-MM-dd";
  listVideo.pageSize = 7;
  UpdatePanel2.Update();
  }
  }

问题:当点击数的一个末节点 更新 自定义控件,自定义控件里是一个带翻页的列表,可执行到自定义列表的 if (!IsPostBack)的位置 始终不能重新根据设置加载列表,请高手指点!在线等!谢谢

------解决方案--------------------
好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好好
------解决方案--------------------
好好好好好好好好好好好好好好好好