Show/Hide Div tags from apsx.vb code

Hi Experts,

I'm writing a web application in using visual basic and I have the following div tag defined.  I also have another div tag in the same position overlaying this one, so at certain points I want to make this div tag hidden.  I need to do this from the aspx.vb file associated with this page.  I've declared the div tag as runat="server" as follows:

            <div id="runtestschoices" runat="server">
                <asp:CheckBoxList ID="CheckBoxList1" runat="server" CellPadding="0"
                    CellSpacing="0" Font-Size="Small">
                    <asp:ListItem Selected="True">Summary</asp:ListItem>
                    <asp:ListItem Selected="True">Extract fields</asp:ListItem>

This is the code I'm using in my aspx.vb file

        Dim runtestschoices As HtmlGenericControl
        runtestschoices.Visible = False

But at the 2nd line I get the following error 'Object reference not set to an instance of an object.'

Can someone tell me exactly how to hide/show div tags on my aspx page from the code behind the page?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
You shouldn't need the first line. Your DIV is already declared in the page and a HtmlGenericControl will already exist for it, so all you need to do is set the Visible property:
runtestschoices.Visible = False

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

Please find the attached project. I have done a similar one.

I think you should remove the below line:
Dim runtestschoices As HtmlGenericControl

MOSSPOINTAuthor Commented:
Thanks, sometimes the simplest things?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.