firesock 0 Newbie Poster

HI guys,
I'm having a rough time trying to solve a problem left by my old colleague, he developed a dll that removes all the controls like combo's, dropdown, hyperlink's and buttons from a page before print or export to excel, but every time i have combo's or checkboxes it freack's out and an ie code blocks error appear i already open the dll font code and nothing seems to be wrong, at the aspx code there´s not a single ie code block, initially there was a little script to retrieve the name of the control from a dictionary but i already remove that still the error occur, and i don´t know what´s the problem. Here´s an example of the code for the page preparation:

else if (gv.Controls[i].GetType() == typeof(DropDownList))
                {
                    if ((gv.Controls[i] as DropDownList).SelectedItem.Text != null)
                    {
                        l.Text = (gv.Controls[i] as DropDownList).SelectedItem.Text;
                        gv.Controls.Remove(gv.Controls[i]);
                        gv.Controls.AddAt(i, l);
                    }
                    else 
                    {
                        l.Text = "NA";
                        gv.Controls.Remove(gv.Controls[i]);
                        gv.Controls.AddAt(i, l); 
                    }

Thanks in advance