Hashtable

Discussion in 'ASP .Net' started by Mark Rae, Jul 14, 2006.

  1. Mark Rae

    Mark Rae Guest

    "Etariq" <> wrote in message
    news:%...

    > am using a hasg table to stor information for use by enum in void i made
    > but for some reson the hashtable is sorted how can i override the sortingi
    > need the data the way i have added them


    Show us your code.
     
    Mark Rae, Jul 14, 2006
    #1
    1. Advertising

  2. You can use a SortedList to sort based on the keys (you can provide your own
    IComparer to specify how it shoudl be sorted).

    If you want them ordered the way they were inputted, I'd suggest you look at
    one of these:
    http://www.codeproject.com/csharp/KeyedList.asp
    http://www.codeproject.com/csharp/hashlistarticle.asp


    Karl

    --
    http://www.openmymind.net/
    http://www.codebetter.com/


    "Etariq" <> wrote in message
    news:%...
    > hi all
    > am using a hasg table to stor information for use by enum in void i made
    > but for some reson the hashtable is sorted how can i override the sortingi
    > need the data the way i have added them
    >
    >
     
    Karl Seguin [MVP], Jul 14, 2006
    #2
    1. Advertising

  3. Mark Rae

    Etariq Guest

    hi all
    am using a hasg table to stor information for use by enum in void i made but
    for some reson the hashtable is sorted how can i override the sortingi need
    the data the way i have added them
     
    Etariq, Jul 14, 2006
    #3
  4. Mark Rae

    Etariq Guest

    the hash table decleration

    hasgtable tablecels = new hashtable();

    tablecels.add("1","Content");

    tablecels.add("2","Content2");

    .......



    this is the Void

    private static void GetMyMultiHeader(GridViewRowEventArgs e, Hashtable
    GetCels)

    {

    if (e.Row.RowType == DataControlRowType.Header)

    {

    GridViewRow row;

    IDictionaryEnumerator enumCels = GetCels.GetEnumerator();

    row = new GridViewRow(0, 0, DataControlRowType.Header,
    DataControlRowState.Normal);

    while (enumCels.MoveNext())

    {

    TableCell Cell;

    Cell = new TableCell();

    Cell.ColumnSpan = Convert.ToInt16(enumCels.Value.ToString());

    Cell.Controls.Add(new LiteralControl(enumCels.Key.ToString()));

    Cell.HorizontalAlign = HorizontalAlign.Center;

    Cell.ForeColor = Color.White;

    // row.Cells.Add(Cell);

    row.Cells.AddAt(Convert.ToInt16(enumCels.Key.ToString()), Cell);

    }

    e.Row.Parent.Controls.AddAt(0, row);

    }

    }

    "Mark Rae" <> wrote in message
    news:...
    > "Etariq" <> wrote in message
    > news:%...
    >
    >> am using a hasg table to stor information for use by enum in void i made
    >> but for some reson the hashtable is sorted how can i override the
    >> sortingi need the data the way i have added them

    >
    > Show us your code.
    >
     
    Etariq, Jul 15, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guillermo

    Problem with hashTable

    Guillermo, Mar 4, 2004, in forum: Perl
    Replies:
    1
    Views:
    618
    Gunnar Hjalmarsson
    Mar 4, 2004
  2. Jonathan Wolfson

    vbc compilation fails when using Hashtable

    Jonathan Wolfson, Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    558
    Tu-Thach
    Jun 27, 2003
  3. John E

    Get Hashtable Object Directly

    John E, Oct 8, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,334
    Nicholas Paldino [.NET/C# MVP]
    Oct 8, 2003
  4. diya

    Type Hashtable not defined

    diya, Oct 31, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,794
    Nicole Calinoiu
    Oct 31, 2003
  5. D. Shane Fowlkes

    ArrayList versus HashTable

    D. Shane Fowlkes, Feb 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    17,792
    Kevin Spencer
    Feb 12, 2004
Loading...

Share This Page