Re: pop Up Window from .cs file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well, I dont think that is going to work for me either.
Basically, what I'm trying to do is something like this

website.aspx:
<form id="form1" runat="server">
<asp:TextBox id="Mytext" runat="server" />
<asp:imageButton id="ResetButton" imageURL="blah.gif" runat="server" />
</form>

website.aspx.cs:
private void ResetButton_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
// Code that will pop-up a window

// "form1" Processing
}

As you can see above, I need 2 things to happen when the "ResetButton" is
clicked.
a) form submission and processing in the _Click event handler
b) Popup a window

Now, if I use regular HTML buttons, I can use an
"onClick=someJavascriptFunction()" event in the website.aspx to pop-up a
window, but that prevents me from submitting/processing the form data using
the ResetButton_Click event handler in the website.aspx.cs file.
I know that I could do form submission from the someJavascriptFunction() ,
but I dont want to do that.

I need the code-behind to open this pop-up window. If thats even possible.

I hope that makes sense?

Thanks.


"Brock Allen" <ballen@xxxxxxxxxxxxxxxxx> wrote in message
news:b8743b112761a8c78b6d77eb1dfc@xxxxxxxxxxxxxxxxxxxxxxx
> Check out Page.RegisterClientScriptBlock. It asks the page to emit a block
> of js for you. You can then call that from, say, an onclick event.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
> > Is it possible to pop-up a window from the code-behind
> > aspx.cs file on an OnClick event?
> > If so, how?
> > I've tried something like the following, but it doesnt seem to work.
> > private void MyButton_Click(object sender,
> > System.Web.UI.ImageClickEventArgs
> > e)
> > {
> >
> > Response.Write("<script>window.open('mypopUp_dialog.aspx');<script>");
> >
> > }
> >
> > I don't want to use in-line javascript code or use a <script> tag
> > within my
> > aspx file
> > itself.
>
>


.



Relevant Pages