473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

A pop up window from a C# code behind

I'm a little surprised. I tried to search for a way to open a modal dialog
using c# in a code behind file but couldn't really find it. I know there is a
way to do it, but I guess I'm still struggling learning the help system.

Here is the deal. I am writing web based front ends. I'm right now writing
my error handler. It's designed to be quite powerful but for now all I want
to do is pop up a modal window to which I can pass an error message. That's
all.

Could someone point me in the right direction please?
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus
Dec 6 '05 #1
1 2764
Hi,

you cannot do that from the code behind, that code is executed 100% in the
server, not in the client.
what you can do is send the code to the client to do so, define a JScript
function that open the windows as you want it and simply put the code to
call this method, there are several ways of doung it , like:

<scrupt>
function Callme( msg)
{
alert( msg );
}
</script>
<body runat=server id=theBody>

in the code behind

HtmlGenericControl theBody;

if ( somecondition)
theBody.AddAttribute( "onclick", "Callme('some error msg');");

}

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Rik Brooks" <rb*****@hhcc.com.donotspam> wrote in message
news:B1**********************************@microsof t.com...
I'm a little surprised. I tried to search for a way to open a modal dialog
using c# in a code behind file but couldn't really find it. I know there
is a
way to do it, but I guess I'm still struggling learning the help system.

Here is the deal. I am writing web based front ends. I'm right now writing
my error handler. It's designed to be quite powerful but for now all I
want
to do is pop up a modal window to which I can pass an error message.
That's
all.

Could someone point me in the right direction please?
----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus

Dec 6 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
by: Newbie | last post by:
I'm having trouble changing the width of my pop up window. Changing the width has no effect. private void LinkButton1_Click(object sender, System.EventArgs e) { string script = "<script...
3
by: Nevyn Twyll | last post by:
I've got a web form with a number of dropdowns, combos, etc. When the user submits the form, I want to redirect them to another form, but I need to pop it in another window. So, I have a hyperlink...
5
by: Nazir | last post by:
I am trying to do something pretty simple - but can't see how it can be done in ASP.NET. I have an aspx web page with a form which opens up a new window. The web page uses code behind to build...
5
by: Mark | last post by:
Hi all, how do I open a javascript window from a code behind page? I was using Response.Write("<script language='javascript'>window.open('url','name','options');</script>") but now for some...
2
by: Chris | last post by:
I know this is a dead horse I'm beating but why is it so impossible to ask for functionality in the HTML tag to open a window/page more controllable? why is: <a href="somepage.aspx?value1=xyz"...
2
by: Rob R. Ainscough | last post by:
In my code behind (VB.NET 2.0), I've been using Response.Redirect("mypage.aspx") to navigate from one page to the next. What I'd like to do now is load a new browser window and load it with the...
3
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.