very urgent....regarding MultiColumn ListBox

  • 13 years ago

    Hi experts,

    I need to implement a multicolumn listbox in my web application.

    But I dont know how to implement a multicolumn ListBox using C#.

    Help me in this regard.

    Thank you,

    angarika

  • 13 years ago

    Hi  try it for add item in listbox 

    private void AddRole()
      {
       try
       {
        lblMessage.Text = "";
        ListItem[] selItems = new ListItem[lstUserRoles.Items.Count];
        int noOfRoles = 0;
        for(int k=0;k<lstUserRoles.Items.Count;k++)
        {
         if(lstUserRoles.Items[k].Selected)
          selItems[noOfRoles++] = lstUserRoles.Items[k];
        }
        if(noOfRoles > 0)
        {
         for(int k=0;k<selItems.Length;k++)
         {
          if(selItems[k] != null && lstAssignRolesUser.Items.FindByValue(selItems[k].Value) == null)
           lstAssignRolesUser.Items.Add(selItems[k]);
         }
        }
        else
        {
         lblMessage.Text = "Select Role(s) and Add";
        }
       }
       catch(Exception ex)
       {
        MITSLogging.WriteLog("AddRole",ex.Message);
        throw;
       }
      }

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor