当我点击 Edit 触发 OnEditCommand 后, 我想在所显示的 项里, 
动态绑定 Session 中的数据到 RadioButtonList, 怎么弄?代码太长贴不了, 附就是以下DataList 的RadioButtonList <form runat="server">
  <!-- Begin flMng -->
   <asp:Label id="flMngDebugLabel" runat="server" />
   <asp:Label id="flMngNavigatorLabel" runat="server" />
   <asp:Label id="flMngInfoLabel" runat="server" />
   <asp:PlaceHolder id="flMngPh" runat="server" />
  
  <div class="flMngFolderBar algr">
   <asp:PlaceHolder id=flMngFolderPh runat=server
    />
  </div>
 
  <asp:DataList id="flMngFolderList" runat="server"
   BorderColor="black"
   CellPadding="5"
   CellSpacing="5"
   RepeatDirection="Vertical"
   RepeatLayout="Flow"
   RepeatColumns="10"
   ShowBorder="True"
   OnEditCommand="flMngEditCmd"
   OnItemCommand="flMngItemCmd"
   >
 
   <HeaderTemplate>
    <h3>目录:</h3>
    <ol class="flMngFolderList">
   </HeaderTemplate>
   
   <HeaderStyle BackColor="#aaaadd">
   </HeaderStyle>
  
   <AlternatingItemStyle BackColor="Gainsboro">
   </AlternatingItemStyle>
    
   <ItemTemplate>
    <li class="flMngDiv">
     <div class="fltr">
      <asp:LinkButton id="flMngEditButton" 
       Text="Edit" 
       CommandName="Edit"
       runat="server"
       />
     </div>
     <a href="?path=<%# DataBinder.Eval(Container.DataItem, "FolderRelativePath") %>">
      <%# DataBinder.Eval(Container.DataItem, "FolderName") %>
     </a>
    </li> 
   </ItemTemplate>
   
    <EditItemTemplate>
    <li>
     <a href="?path=<%# DataBinder.Eval(Container.DataItem, "FolderRelativePath") %>">
      <%# DataBinder.Eval(Container.DataItem, "FolderName") %>
     </a>
     <ul class="flMngEdit">
      <li>
       <span onclick="return confirm('确定要重命名文件夹吗?')">
        <asp:LinkButton id=flMngUpdateFolderLb runat=server
         Text="Rename:" 
         CommandName="flMngRenameFolderLb" 
         /> 
       </span>
       
       <asp:TextBox id="flMngUpdateFolderTbx" runat="server"
        Text=<%# DataBinder.Eval(Container.DataItem,"FolderName")%>
        />
        
       <input type="hidden" id=flMngUpdateFolderHid runat=server
        value=
        <%# DataBinder.Eval(Container.DataItem,"FolderRelativePath")%>
        />
      </li>
      <li>
       <span onclick="return confirm('现在添加新文件夹吗?')">
        <asp:LinkButton id=flMngNewFolderLb runat=server
         Text="New Folder:" 
         CommandName="NewSubFolder" 
         /> 
       </span>
       <asp:TextBox id="flMngNewFolderTbx" runat="server"
        />
      </li>
      <li> 
       <span onclick="return confirm('确定要删除文件夹吗?')">
        <asp:LinkButton id=flMngDeleteFolderLb runat=server
         Text="Delete:" 
         CommandName="flMngDeleteFolder" 
         /> 
         <%# DataBinder.Eval(Container.DataItem,"FolderRelativePath")%>
       </span>
      </li>
      <li>
       <span onclick="return confirm('现在移动文件夹到根目录吗?')">
        <asp:LinkButton id=flMngMoveFolderToRootLb runat=server
         Text="Move To Root:" 
         CommandName="MoveFolderToRoot" 
         /> 
       </span>
      </li>
      <li>
       <span onclick="return confirm('现在移动文件夹到父目录吗?')">
        <asp:LinkButton id=flMngMoveFolderToParentLb runat=server
         Text="Move To Parent:" 
         CommandName="MoveFolderToParent" 
         /> 
       </span>
      </li>
      <li>
       <span onclick="return confirm('现在移动文件夹到至选定目录吗?')">
        <asp:LinkButton id=flMngMoveFolderInLb runat=server
         Text="Move Parent In:" 
         CommandName="MoveFolderIn" 
         /> 
       </span>
        
       <asp:RadioButtonList id="flMngRdoBtnLst"
            runat="server"/>      </li>
     </ul>
    </li> 
    </EditItemTemplate>
<%--
   <SeparatorTemplate> 
   </SeparatorTemplate>
--%>
   <FooterTemplate>
    </ol>
   </FooterTemplate>
  </asp:DataList>
  
  <div class="flMngUpload"><asp:PlaceHolder id=flMngUploadPh runat=server /></div>
  <!-- End flMng -->
 </form>

解决方案 »

  1.   

    你的session是什么类型?若是可数据绑定的类型,那么在OnEditCommand事件中转换一下就可以赋给RadioButtonList了
      

  2.   

    DataTable我试试,,, 不过好像不是这么简单呀.
    在 DataList 中的控件处理有点复杂....
      

  3.   

    void flMngEditCmd(Object sender, DataListCommandEventArgs e) 
     {
      DataList dl = (DataList)sender;
      dl.EditItemIndex = e.Item.ItemIndex;
      BindList(dl);  
      
      //HttpContext.Current.Response.Write(flMngRdoBtnLst); // 找不到控件
     }没法子了. 我用 FindControl 也找不到.
      

  4.   

    在itemdatabind 事件里做
      

  5.   

    哦, 谢谢. 貌似用 FindControl 已经找到控件了.  void flMngEditCmd(Object sender, DataListCommandEventArgs e) 
     {
      DataList dl = (DataList)sender;
      dl.EditItemIndex = e.Item.ItemIndex;
      BindList(dl);  
      
      HttpContext.Current.Response.Write("<li/>:"+e.Item.ItemIndex);
      
      RadioButtonList rbl =
       (RadioButtonList)(dl.Items[e.Item.ItemIndex].FindControl("flMngRdoBtnLst"));
      
      HttpContext.Current.Response.Write("<li/>");
      HttpContext.Current.Response.Write(rbl==null);
     }
      

  6.   

    问题解决...等一会再结帐... void flMngEditCmd(Object sender, DataListCommandEventArgs e) 
     {
      DataList dl = (DataList)sender;
      dl.EditItemIndex = e.Item.ItemIndex;
      BindList(dl);  
      
      RadioButtonList rbl =
       (RadioButtonList)(dl.Items[e.Item.ItemIndex].FindControl("flMngRdoBtnLst"));
       
      rbl.DataSource = (DataTable)Session["flMngVsFolderList"];
      rbl.DataBind();
     }