我用C#做编程语言当我使用Directory.GetDirectories获取某个目录的子目录列表并使用foreach in循环显示出来的时候发现文件夹的循序是混乱的,比如001、002、003、004、005,可能排序成:003、001、002、004、005请问这个问题要如何解决?是否有其他函数代替呢?另外当我想得到某个文件夹下文件的数量的话一般是
    int getfilecount(string gpath) {
        string[] filelist = Directory.GetFiles(gpath);
        return filelist.Length;
    }
但如果文件数太多应该会消耗很大吧,有没有直接得到数量的函数呢?再有就是有关表单的问题我做了一组
<asp:RadioButton runat="server" id="中文1" GroupName="cname" ></asp:RadioButton>
<asp:RadioButton runat="server" id="中文2" GroupName="cname" ></asp:RadioButton>
递交以后通过
cname= Request["cname"];
得到选择项的ID值,但其中的中文不能正常显示或者干脆没有,这是为什么呢?有没有方法获取这样RadioButton的value值呢?(情况比较特殊,不能使用RadioButtonList)谢谢。

解决方案 »

  1.   

    http://blog.csdn.net/chengking/archive/2005/10/07/496640.aspx
      

  2.   

    For Each foundDirectory As String In _
      My.Computer.FileSystem.GetDirectories( _
      My.Computer.FileSystem.SpecialDirectories.MyDocuments, True, _
      "*Logs*")
       
      ListBox1.Items.Add(foundDirectory)
    Next
    自己编写一个函数排序
    cname= Request["cname"];
    cnname为获取的VALUES值,不是ID号
      

  3.   

    文件夹排序肯定是无序的了,你自己重写一些方法来排序吧。至于一组RadioButton那个问题,你用的是ASP的思路吧(通过Request.Form获取值)?如果是这样的话,你应该为该控件的ClientID赋值你要的中文,而ID可以留空或者给正常的对象命名。
      

  4.   

    有没有不通过Request.Form而直接获取值的方法呢?一定要比较所有的对象才能得出到底那个被选中了吗?
      

  5.   

    如果用RadioButtonList的话,因为是和表格一起时用的,会出现这样的提示
    System.Web.UI.WebControls.ListItemCollection 必须具有类型为“System.Web.UI.WebControls.ListItem”的项。“asp:Table”的类型为“System.Web.UI.WebControls.Table”。类似下边的代码。        <asp:RadioButtonList id="RadioButtonList1" runat="server">
                <asp:ListItem Value="">aa</asp:ListItem>
                <asp:Table id="votelist" runat="server" Width="90%" BackColor="Gray" CellPadding="5" CellSpacing="1">
                    <asp:TableRow runat="server" >
                        <asp:TableCell HorizontalAlign="Center" runat="server" BackColor="#f7f7f7" ColumnSpan="2">dd                    </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </asp:RadioButtonList>