Am I missing something

G

Guest

Hi All,
What am I missing. I have trying to create a simple web based
application. Basically there are three textboxes and two buttons (Save,
Reset). I assume the code behind the save button should save the form
information to the databaase. So my question is this: How do I notify
the user the information has been saved? Do I have to redirect to
another page or can I display a message. I would like to do the latter
but I am not sure where to start.

Any information would be great.

Thanks
 
G

Guest

create a literal control on the aspx page and once the information is save in
the database set the text property of this literal control to the msg u wish
to show the user
 
G

Guest

There are diffrent methods to display message to user . Response.Write is the
simplest..

On Save_Click
1) Response.Write ("Your Input is saved")
2) Use <ASP:LABEL> web control with a message , hide it by default. When
ready to display message show the Label and
 
R

Rob Meade

...
Hi All,
What am I missing. I have trying to create a simple web based
application. Basically there are three textboxes and two buttons (Save,
Reset). I assume the code behind the save button should save the form
information to the databaase. So my question is this: How do I notify
the user the information has been saved? Do I have to redirect to
another page or can I display a message. I would like to do the latter
but I am not sure where to start.

I'm assuming you're doing this in .net - so here goes ...

What you want is to perhaps add an event handler for the clicking of the
Save button, if you're using Visual Studio to develop, just double click
your button and it will create the event handler for you. If not, something
like this perhaps:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

End Sub

You should amend the above if you button is called something other than
"Button1".

Ok - so we have an event handler, might be a good idea to make it do
something!

If you were to add a label to your page, you could then set the text of that
label to something when the button was clicked but setting the text value of
the label within the event handler of the button...

So,

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

label1.Text = "You clicked the save button, good for you!"

End Sub

Of course, this would also be a good place to put a call to a function/sub
which does your database work, but we'll leave that for now.

Incidentally, if you are using Visual Studio, when you add your button it'll
have some default text "Label" - if you right-click and choose properties
(assuming the properties window is not already on display) you can clear
this out, either have some text already in there which advises the user what
to do, or perhaps just leave it blank ready for your message when they click
the button.

Hope this helps.

Regards

Rob
 
G

Guest

Thank you all for your quick answers. This is a lot different than ASP.
Do you guys use the VS.Net ID or a text editor. Right now I am using
the IDE but leaning towards going with a text editor. Could you please
explain the advantages of using the IDE?

Thanks again
 
D

Daniel Walzenbach

Hi,

you could use the RegisterStartupScript method as well to write some
javascript to your page which fires e.g. an alert to inform your users that
the page has been saved.
Check it out at :
http://msdn.microsoft.com/library/d...mWebUIPageClassRegisterStartupScriptTopic.asp

Sth. like:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

' save everything
dim result as system.string
if savemethod = true ' I assume that your savemethod returns true if
save was successful
result = "<script language='JavaScript'>alert('Page has been saved
sucessfully!')</script>"
else
result = "<script language='JavaScript'>alert('Error during saving
the page!')</script>"

Me.RegisterStartupScript("Startup", result)

End Sub

Does this help you?

Regards

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top