First leave the .NavigateUrl property empty.
Then add an onClick event to the hyperlink to launch your javascript function. In the code behind Page_Load event:
this.hlnkControl.Attributes.Add("onClick", "onWindow(); return false;")
>I need help with the following:
>
>The code behind creates hyperlink control, dynamically, in the Page_Load method.
>
>Without javascript, the .NavigateUrl property of the hyperlink control would be assigned value like this:
>
>hlnkControl.NavigateUrl = "mypage.aspx?myparam=123&Date=01/01/2003";
>
>
>All would be well but I need to open page mypage.aspx in a small window without toolbar, scrollbars, and a certain size. To do this I need to call a JavaScript funtion.
>
>I have two problems so far that I can't resolve:
>
>1. I created a small JS function OpenWind() (in the HEAD section). And if I replace the NavigateUrl propert string above to the following:
>
>hlnkControl.NavigateUrl = "javascript:OpenWind()";
>
>
>When clicking on this hyperlink it tries to open page 'javascript:OpenWind()'. Which is no good.
>
>2. Even if item 1 would work, how do I pass the parameters "myparam=123&Date=01/01/2003" and aspx page name (mypage.aspx) to the javascript function?
>
>I would appreciate any help or suggestions.
Michael McLain