How do you show an alert from a separate code moduel in asp.net, not the codebehind of a page, thats an easy one.
This is one way to do it from the code behind of a page.
ScriptManager.RegisterStartupScript(Page, Me.GetType, "alert('Hello')", True)
How can i achieve this from a separate code module though, i am not sure. it needs a control and control type for the first to parameteres respectively. So the code above will error out on the first 2 params. Does anyone have a solution?
You need to pass the Page object of the current request to this extern module. Then you can use it in the
RegisterStartupScriptfunction. For example:Some extern class:
In the
aspxpage or CodeBehind: