display hidden div onload

I have a C# web page that contains several checkboxes.  Some of the checkboxes when clicked will display a hidden div containing more detailed checkboxes.  Once they are finished the user clicks save and the data is sent to the database.  My problem is if they come back to that page to edit their information I cant get the div's to appear if the checkbox is set.  I am setting the onclcik events in the Page_PreRender event.:

        protected void Page_PreRender(object sender, System.EventArgs e)
            this.Page.Form.Attributes.Add("onload", "javascript:DiplayBlock('div_surgical_sub');");

Ideas on what i can do to accomplish this????? I tried doing sometihng like the following but was unsuccessful::

this.Page.Form.Attributes.Add("onload", "javascript:DiplayBlock('div_surgical_sub');");
Who is Participating?
DB_FuryAuthor Commented:

Page.ClientScript.RegisterStartupScript(this.GetType(), "clientScript", "javascript:DiplayBlock('div_surgical_sub');", true);
DB_FuryAuthor Commented:
I figured itout
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.