Home All Groups Group Topic Archive Search About

Newbee ASP.NET Questions

Author
10 Mar 2006 9:29 PM
Jonny
Hiya all

Using: ASP.NET Version 1.1

I am learning ASP.NET & would like to know:-

How do I add a Open Browser Dialog behind a server button & validate a
chosen file as a new e-mail attachment?

How do I close an aspx window (client-side)?

How do I set the page when the user visits the site to remove Address Bar &
make the form a fixed size?

Your help would be appreciated

Author
10 Mar 2006 10:49 PM
Rykie
Jonny,

Question why dont you use version 2.0? Dont teach yourself legacy
stuff.

Ok, in answer to your questions:

If you have a button called btnOpen you can do it in the following way;
What I normally do is to put a javascript block in the head section of
the page that will open the new page, the reason for this is that a
server button will do a postback, and you dont always want a postback
event to fire, so in the page_load event I put something like this:
btnOpen.Attributes.Add("onClick","return openWindow();") . You will
understand what I am doing here if you know a bit about javascript, but
essentially the openWindow is the javascript function in the head
section which could be anything, but the important thing is alwasy to
return false in this function else you will get a postback event
happening on the page where you clicked the button, and *most* of the
times this is not really needed. So the javascript function can be:
function openWindow() { window.OpenModalDialog('default.aspx','');
return false; } this function is entirely up to you. The
btnOpen.Attributes.Add function essentially binds a client side onClick
event to it.
Now how do you validate a chosen file; well there are tonnes of topics
on this on the web. Try this link:
http://www.codeproject.com/aspnet/fileupload.asp but if this is not
what you are looking for, open google and type,  .net file upload   and
you will see a lot of help.

Now you cannot close a window client side unless the client wants to,
this is for obvious security reasons. I mean you will not like it if
you browser starts opening and closing windows out of your control, so
the best you can do is to put a button on the page, OR have a
javascript countdown function that will call the famous javascript
window.close(); function. The only real way to do this without client
interaction is to register the window as a control from the 'master'
page; i.e. open the window using javascript but assign it to a variable
and then later on call the variablename.close();

Now the last question; I would not waste any time on this, because in
internet explorer 7 the addressbar will ALWAYS show no matter what you
do. But in google type   javascript openmodaldialog  and have a look at
it, it will help you.

Good luck Rykie
Author
11 Mar 2006 11:44 AM
Jonny
Thank you so much Rykie!!


Show quoteHide quote
"Rykie" <rykneethl***@gmail.com> wrote in message
news:1142030965.949762.36620@j52g2000cwj.googlegroups.com...
> Jonny,
>
> Question why dont you use version 2.0? Dont teach yourself legacy
> stuff.
>
> Ok, in answer to your questions:
>
> If you have a button called btnOpen you can do it in the following way;
> What I normally do is to put a javascript block in the head section of
> the page that will open the new page, the reason for this is that a
> server button will do a postback, and you dont always want a postback
> event to fire, so in the page_load event I put something like this:
> btnOpen.Attributes.Add("onClick","return openWindow();") . You will
> understand what I am doing here if you know a bit about javascript, but
> essentially the openWindow is the javascript function in the head
> section which could be anything, but the important thing is alwasy to
> return false in this function else you will get a postback event
> happening on the page where you clicked the button, and *most* of the
> times this is not really needed. So the javascript function can be:
> function openWindow() { window.OpenModalDialog('default.aspx','');
> return false; } this function is entirely up to you. The
> btnOpen.Attributes.Add function essentially binds a client side onClick
> event to it.
> Now how do you validate a chosen file; well there are tonnes of topics
> on this on the web. Try this link:
> http://www.codeproject.com/aspnet/fileupload.asp but if this is not
> what you are looking for, open google and type,  .net file upload   and
> you will see a lot of help.
>
> Now you cannot close a window client side unless the client wants to,
> this is for obvious security reasons. I mean you will not like it if
> you browser starts opening and closing windows out of your control, so
> the best you can do is to put a button on the page, OR have a
> javascript countdown function that will call the famous javascript
> window.close(); function. The only real way to do this without client
> interaction is to register the window as a control from the 'master'
> page; i.e. open the window using javascript but assign it to a variable
> and then later on call the variablename.close();
>
> Now the last question; I would not waste any time on this, because in
> internet explorer 7 the addressbar will ALWAYS show no matter what you
> do. But in google type   javascript openmodaldialog  and have a look at
> it, it will help you.
>
> Good luck Rykie
>