Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ArrayList items = new ArrayList();

        IEnumerable data = AccessDataSource1.Select(new DataSourceSelectArguments());

        foreach (object item in data)
        {
            DataRowView row       = item as DataRowView;
            string      id        = row["CustomerId"].ToString();
            string      s         = row["ContactName"].ToString().ToUpper();
            string      groupText = "?";
            if (!string.IsNullOrEmpty(s))
            {
                char c = s.Substring(0, 1)[0];
                if ('A' <= c && c <= 'F')
                {
                    groupText = "A-F";
                }
                else if ('G' <= c && c <= 'M')
                {
                    groupText = "G-M";
                }
                else if ('N' <= c && c <= 'S')
                {
                    groupText = "N-S";
                }
                else if ('T' <= c && c <= 'Z')
                {
                    groupText = "T-Z";
                }
            }
            items.Add(new MyItem(id, s, groupText));
        }

        ASPxTitleIndex1.DataSource = items;
        ASPxTitleIndex1.DataBind();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     string[] names = File.ReadAllLines(Server.MapPath("~/App_Data/customers.txt"), Encoding.Unicode);
     ASPxTitleIndex1.DataSource = names;
     ASPxTitleIndex1.DataBind();
 }