Connecting Tech Pros Worldwide Help | Site Map

About Msg/Alert Boxes in a Web Application

Coleen
Guest
 
Posts: n/a
#1: Jul 21 '05
Please see threads on "Dumb question about Message boxes" - I went to the
specified link - this works great if all you want to do is display a message
box before any of your script behind the aspx.vb runs or on the click event,
but if you are actually trying to validate user selections, such as when an
item from a drop-down is selected, I get an error if I put it in this code:

<asp:dropdownlist id="ddl_year" runat="server" Width="40%"
CssClass="datagrid " AutoPostBack="True" OnSelectedIndexChanged="script
language="VBScript"> MsgBox "Hello there" </script>"></asp:dropdownlist>

I get the red-squiggly on ="VBScript" and "Hello There" and of course a
build error when I try to run it. What I really need to do is validate a
selection from the dropdown list box (a date), if it is not the current
date, then I need a msg or alert box to warn the user that their selection
is not current and that the data they will be viewing is not updateable.
Where do I need to put this code to get it to run after a selection has been
made? Any suggestions? Thanks

Coleen


Scott M.
Guest
 
Posts: n/a
#2: Jul 21 '05

re: About Msg/Alert Boxes in a Web Application


Why not use a custom validator control for this? This allows you to write
your own client-side JavaScript (so you can include the native alert()).
And in the corresponding server-side validation, you can push a client-side
script down to the client if need be.


"Coleen" <coleenholley@yahoo.com> wrote in message
news:O$uzw3euDHA.1340@TK2MSFTNGP09.phx.gbl...[color=blue]
> Please see threads on "Dumb question about Message boxes" - I went to the
> specified link - this works great if all you want to do is display a[/color]
message[color=blue]
> box before any of your script behind the aspx.vb runs or on the click[/color]
event,[color=blue]
> but if you are actually trying to validate user selections, such as when[/color]
an[color=blue]
> item from a drop-down is selected, I get an error if I put it in this[/color]
code:[color=blue]
>
> <asp:dropdownlist id="ddl_year" runat="server" Width="40%"
> CssClass="datagrid " AutoPostBack="True" OnSelectedIndexChanged="script
> language="VBScript"> MsgBox "Hello there" </script>"></asp:dropdownlist>
>
> I get the red-squiggly on ="VBScript" and "Hello There" and of course a
> build error when I try to run it. What I really need to do is validate a
> selection from the dropdown list box (a date), if it is not the current
> date, then I need a msg or alert box to warn the user that their selection
> is not current and that the data they will be viewing is not updateable.
> Where do I need to put this code to get it to run after a selection has[/color]
been[color=blue]
> made? Any suggestions? Thanks
>
> Coleen
>
>[/color]


Coleen
Guest
 
Posts: n/a
#3: Jul 21 '05

re: About Msg/Alert Boxes in a Web Application


The whole point is that I don't know JavaScript!!! I was/am searching for
an alternative to writing JavaScript code to do the validation. The link
that Michael Lang gave looks great, but when I use it in my .aspx code for
the drop down, I get errors. Any suggestions?

"Scott M." <s-mar@BADSPAMsnet.net> wrote in message
news:%234750OhuDHA.2408@tk2msftngp13.phx.gbl...[color=blue]
> Why not use a custom validator control for this? This allows you to write
> your own client-side JavaScript (so you can include the native alert()).
> And in the corresponding server-side validation, you can push a[/color]
client-side[color=blue]
> script down to the client if need be.
>
>
> "Coleen" <coleenholley@yahoo.com> wrote in message
> news:O$uzw3euDHA.1340@TK2MSFTNGP09.phx.gbl...[color=green]
> > Please see threads on "Dumb question about Message boxes" - I went to[/color][/color]
the[color=blue][color=green]
> > specified link - this works great if all you want to do is display a[/color]
> message[color=green]
> > box before any of your script behind the aspx.vb runs or on the click[/color]
> event,[color=green]
> > but if you are actually trying to validate user selections, such as when[/color]
> an[color=green]
> > item from a drop-down is selected, I get an error if I put it in this[/color]
> code:[color=green]
> >
> > <asp:dropdownlist id="ddl_year" runat="server" Width="40%"
> > CssClass="datagrid " AutoPostBack="True" OnSelectedIndexChanged="script
> > language="VBScript"> MsgBox "Hello there" </script>"></asp:dropdownlist>
> >
> > I get the red-squiggly on ="VBScript" and "Hello There" and of course a
> > build error when I try to run it. What I really need to do is validate[/color][/color]
a[color=blue][color=green]
> > selection from the dropdown list box (a date), if it is not the current
> > date, then I need a msg or alert box to warn the user that their[/color][/color]
selection[color=blue][color=green]
> > is not current and that the data they will be viewing is not updateable.
> > Where do I need to put this code to get it to run after a selection has[/color]
> been[color=green]
> > made? Any suggestions? Thanks
> >
> > Coleen
> >
> >[/color]
>
>[/color]


Scott M.
Guest
 
Posts: n/a
#4: Jul 21 '05

re: About Msg/Alert Boxes in a Web Application


Yes, my suggestion is the same as before. I'm sorry that you don't want to
use JavaScript, but JavaScript is the only client-side scripting language
that is supported by all mainstream browsers. For this reason, JavaScript
is the defacto client-side scripting standard.

You asked how to accomplish your goal and this is how it is done.


"Coleen" <coleenholley@yahoo.com> wrote in message
news:O3FQnTpuDHA.3536@tk2msftngp13.phx.gbl...[color=blue]
> The whole point is that I don't know JavaScript!!! I was/am searching for
> an alternative to writing JavaScript code to do the validation. The link
> that Michael Lang gave looks great, but when I use it in my .aspx code for
> the drop down, I get errors. Any suggestions?
>
> "Scott M." <s-mar@BADSPAMsnet.net> wrote in message
> news:%234750OhuDHA.2408@tk2msftngp13.phx.gbl...[color=green]
> > Why not use a custom validator control for this? This allows you to[/color][/color]
write[color=blue][color=green]
> > your own client-side JavaScript (so you can include the native alert()).
> > And in the corresponding server-side validation, you can push a[/color]
> client-side[color=green]
> > script down to the client if need be.
> >
> >
> > "Coleen" <coleenholley@yahoo.com> wrote in message
> > news:O$uzw3euDHA.1340@TK2MSFTNGP09.phx.gbl...[color=darkred]
> > > Please see threads on "Dumb question about Message boxes" - I went to[/color][/color]
> the[color=green][color=darkred]
> > > specified link - this works great if all you want to do is display a[/color]
> > message[color=darkred]
> > > box before any of your script behind the aspx.vb runs or on the click[/color]
> > event,[color=darkred]
> > > but if you are actually trying to validate user selections, such as[/color][/color][/color]
when[color=blue][color=green]
> > an[color=darkred]
> > > item from a drop-down is selected, I get an error if I put it in this[/color]
> > code:[color=darkred]
> > >
> > > <asp:dropdownlist id="ddl_year" runat="server" Width="40%"
> > > CssClass="datagrid " AutoPostBack="True"[/color][/color][/color]
OnSelectedIndexChanged="script[color=blue][color=green][color=darkred]
> > > language="VBScript"> MsgBox "Hello there"[/color][/color][/color]
</script>"></asp:dropdownlist>[color=blue][color=green][color=darkred]
> > >
> > > I get the red-squiggly on ="VBScript" and "Hello There" and of course[/color][/color][/color]
a[color=blue][color=green][color=darkred]
> > > build error when I try to run it. What I really need to do is[/color][/color][/color]
validate[color=blue]
> a[color=green][color=darkred]
> > > selection from the dropdown list box (a date), if it is not the[/color][/color][/color]
current[color=blue][color=green][color=darkred]
> > > date, then I need a msg or alert box to warn the user that their[/color][/color]
> selection[color=green][color=darkred]
> > > is not current and that the data they will be viewing is not[/color][/color][/color]
updateable.[color=blue][color=green][color=darkred]
> > > Where do I need to put this code to get it to run after a selection[/color][/color][/color]
has[color=blue][color=green]
> > been[color=darkred]
> > > made? Any suggestions? Thanks
> > >
> > > Coleen
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Coleen
Guest
 
Posts: n/a
#5: Jul 21 '05

re: About Msg/Alert Boxes in a Web Application


It's not that I don't want to use it...it's that I don't know JavaScript.
This means a learning period, which I was hoping to avoid, since we need to
keep this project on schedule. But, alas, if I have to learn JavaScript, I
have to; I guess it will look good in a resume down the line...Thanks for
your help.
"Scott M." <s-mar@BADSPAMsnet.net> wrote in message
news:%23ctReBruDHA.2352@TK2MSFTNGP09.phx.gbl...[color=blue]
> Yes, my suggestion is the same as before. I'm sorry that you don't want[/color]
to[color=blue]
> use JavaScript, but JavaScript is the only client-side scripting language
> that is supported by all mainstream browsers. For this reason, JavaScript
> is the defacto client-side scripting standard.
>
> You asked how to accomplish your goal and this is how it is done.
>
>
> "Coleen" <coleenholley@yahoo.com> wrote in message
> news:O3FQnTpuDHA.3536@tk2msftngp13.phx.gbl...[color=green]
> > The whole point is that I don't know JavaScript!!! I was/am searching[/color][/color]
for[color=blue][color=green]
> > an alternative to writing JavaScript code to do the validation. The[/color][/color]
link[color=blue][color=green]
> > that Michael Lang gave looks great, but when I use it in my .aspx code[/color][/color]
for[color=blue][color=green]
> > the drop down, I get errors. Any suggestions?
> >
> > "Scott M." <s-mar@BADSPAMsnet.net> wrote in message
> > news:%234750OhuDHA.2408@tk2msftngp13.phx.gbl...[color=darkred]
> > > Why not use a custom validator control for this? This allows you to[/color][/color]
> write[color=green][color=darkred]
> > > your own client-side JavaScript (so you can include the native[/color][/color][/color]
alert()).[color=blue][color=green][color=darkred]
> > > And in the corresponding server-side validation, you can push a[/color]
> > client-side[color=darkred]
> > > script down to the client if need be.
> > >
> > >
> > > "Coleen" <coleenholley@yahoo.com> wrote in message
> > > news:O$uzw3euDHA.1340@TK2MSFTNGP09.phx.gbl...
> > > > Please see threads on "Dumb question about Message boxes" - I went[/color][/color][/color]
to[color=blue][color=green]
> > the[color=darkred]
> > > > specified link - this works great if all you want to do is display a
> > > message
> > > > box before any of your script behind the aspx.vb runs or on the[/color][/color][/color]
click[color=blue][color=green][color=darkred]
> > > event,
> > > > but if you are actually trying to validate user selections, such as[/color][/color]
> when[color=green][color=darkred]
> > > an
> > > > item from a drop-down is selected, I get an error if I put it in[/color][/color][/color]
this[color=blue][color=green][color=darkred]
> > > code:
> > > >
> > > > <asp:dropdownlist id="ddl_year" runat="server" Width="40%"
> > > > CssClass="datagrid " AutoPostBack="True"[/color][/color]
> OnSelectedIndexChanged="script[color=green][color=darkred]
> > > > language="VBScript"> MsgBox "Hello there"[/color][/color]
> </script>"></asp:dropdownlist>[color=green][color=darkred]
> > > >
> > > > I get the red-squiggly on ="VBScript" and "Hello There" and of[/color][/color][/color]
course[color=blue]
> a[color=green][color=darkred]
> > > > build error when I try to run it. What I really need to do is[/color][/color]
> validate[color=green]
> > a[color=darkred]
> > > > selection from the dropdown list box (a date), if it is not the[/color][/color]
> current[color=green][color=darkred]
> > > > date, then I need a msg or alert box to warn the user that their[/color]
> > selection[color=darkred]
> > > > is not current and that the data they will be viewing is not[/color][/color]
> updateable.[color=green][color=darkred]
> > > > Where do I need to put this code to get it to run after a selection[/color][/color]
> has[color=green][color=darkred]
> > > been
> > > > made? Any suggestions? Thanks
> > > >
> > > > Coleen
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread


Similar .NET Framework bytes