Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling JS func from code behind with parameters
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00845364
Message ID:
00845371
Vues:
18
I will try your approach. Thank you very much!

>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform