ASP.NET - Performance issue - Asked By koteswara rao arvapalli on 10-Jul-13 01:59 AM


  <asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple">
            <asp:ListItem>A</asp:ListItem>
            <asp:ListItem>B</asp:ListItem>
            <asp:ListItem>C</asp:ListItem>
            <asp:ListItem>D</asp:ListItem>
            <asp:ListItem>E</asp:ListItem>
        </asp:ListBox>

// its coming from Db
string commaseperatessting = "A,B,D";

               //split the string
                //1st model
                string[] ar = commaseperatessting.Split(',').ToArray();
                ArrayList arl = new ArrayList();
                List<string> lis = new List<string>();
                lis = commaseperatessting.Split(',').ToList();
                foreach (ListItem li in ListBox1.Items)
                {
                    foreach(string s in lis)
                    {
                        if (s == li.Text)
                        {
                            li.Selected = true;
                        }
                    }
                }
if there is any alternative 

i have to improve performance withot looing all items in ListBox1
Robbe Morris replied to koteswara rao arvapalli on 10-Jul-13 06:27 AM
No and this will run pretty fast.  These are the areas in ASP.NET that are performance problems.