Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-03-16 : 09:26:35
|
How do I get the label to appear when I need it?
A user fills out a form and hits the submit button. I have it redirecting to the Default.aspx page and on that page I have a label that states info was update.
Only thing is how do I hide the label when coming into the Default.aspx page the first time?
This is what I have now and the label displays all the time
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack = True Then
Label1.Text = "Your update was submitted into the database."
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-03-16 : 09:52:38
|
Never mind got the answer:
Put this under the button click event: Session("FDBCK") = "Your update was submitted into the database." response.redirect(default.aspx)
Added this to default.aspx Page load Lable1.Text=Session("FDBCK") |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2010-03-18 : 10:24:26
|
dont use the session object, its a waste of resources.
use either a query string or viewstate. much better |
 |
|
praveenbattula
Starting Member
4 Posts |
Posted - 2010-03-18 : 23:15:41
|
The good way is below. submitform.aspx Write all code in the button click event to grab and update database. And before end of button click event handler, write like Response.Redirect("~/Default.aspx?mode=1");
Default.aspx: In page load look for any query string and do this.
if(!IsPostBack) { if(Request.QueryString["mode"] != null) { if(Request.QueryString["mode"].equals("1", StringComparision.IgnoreCase)) lblMessage.Text = "Data successfully updated."; } }
Let me know, if you need any more help. http://praveenbattula.blogspot.com[url][/url]
Rare Solutions http://praveenbattula.blogspot.com |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2010-03-19 : 17:25:03
|
thats the query string method, which doesnt hold any resources, view state also is good, but uses up resources.
best wishes |
 |
|
|
|
|