Hi,
Look into your code carefully:
image.Attributes.Add("Onclick", "javascript:return toggle('" + grd.ClientID + "','" + image.ClientID + "');")
It should be like:
image.Attributes.Add("onclick", "javascript:return toggle('" + grd.ClientID + "','" + image.ClientID + "');")
and paste it inside page_Load event..
All the best.
--AK