16 Replies - 2373 Views - Last Post: 28 April 2011 - 05:25 AM
#1
alert problem in c# asp.net
Posted 01 April 2011 - 02:02 AM
Hi..
am using alert box in my asp.net login page... after i check username and password if it is wrong i have to show alert... but my problem is when i show alert my background picture disappears till alert closed...
to alert i used
ScriptManager.RegisterStartupScript(this.Page,this.GetType(),"Alert","alert('Enter the valid username & password')",true);
thank u
am using alert box in my asp.net login page... after i check username and password if it is wrong i have to show alert... but my problem is when i show alert my background picture disappears till alert closed...
to alert i used
ScriptManager.RegisterStartupScript(this.Page,this.GetType(),"Alert","alert('Enter the valid username & password')",true);
thank u
Replies To: alert problem in c# asp.net
#2
Re: alert problem in c# asp.net
Posted 01 April 2011 - 02:27 AM
This is a normal effect for Javascript alert ,
try the window.Open Method to create your own popup ,
or look for jQuery popups.
try the window.Open Method to create your own popup ,
or look for jQuery popups.
This post has been edited by marinus: 01 April 2011 - 02:27 AM
#3
Re: alert problem in c# asp.net
Posted 01 April 2011 - 02:49 AM
thank u... but i do no jquery... let me try
#4
Re: alert problem in c# asp.net
Posted 01 April 2011 - 02:56 AM
Wait......!!
I got the problem
The alert starts before page loads so what i found as the work around is.
modify <body> tag as follows
Then in the Code Behind\C# file add this in PageLoad event.
This waits until the all the html is loaded and only then it will alert you.
I think the script manager puts the script in the <head> tag which means the script will load immediately which is not what you wanted .
I think we are Winning!
Greetings
Marinus
I got the problem
The alert starts before page loads so what i found as the work around is.
modify <body> tag as follows
<body runat="server" id="myBody">
Then in the Code Behind\C# file add this in PageLoad event.
protected void Page_Load(object sender, EventArgs e)
{
myBody.Attributes.Add("onload","alert('hello');");
}
This waits until the all the html is loaded and only then it will alert you.
I think the script manager puts the script in the <head> tag which means the script will load immediately which is not what you wanted .
I think we are Winning!
Greetings
Marinus
This post has been edited by marinus: 01 April 2011 - 02:59 AM
#5
Re: alert problem in c# asp.net
Posted 01 April 2011 - 03:06 AM
Actually my problem is i have one button as login... when i click login after i entered username and password it will check database is name ans password correct id it s wrong then only i need alert....
i used database checking in if it s wrong it comes to else and give alert...
i used database checking in if it s wrong it comes to else and give alert...
#6
Re: alert problem in c# asp.net
Posted 01 April 2011 - 03:10 AM
Then modify like follow
void btnLogin_Click(object sender , EventArgs e)
{
//Database search for user.
if(UserValid)
myBody.Attributes.Add("onload","alert('hello');");
else
myBody.Attributes.Add("onload","alert('enter password & Username');");
}
This post has been edited by marinus: 01 April 2011 - 03:14 AM
#8
Re: alert problem in c# asp.net
Posted 01 April 2011 - 03:57 AM
hey man... its working superb... thanks a lot ..
i catch u soon with another prob
i catch u soon with another prob
#9
Re: alert problem in c# asp.net
Posted 01 April 2011 - 03:59 AM
Don't forget to click the Was This Post Helpful?(+) if i helped you , that would be awesome .
This post has been edited by marinus: 01 April 2011 - 04:04 AM
#11
Re: alert problem in c# asp.net
Posted 04 April 2011 - 01:27 AM
hi....
can u solve this same alert prob with ajax.. can means help me..
can u solve this same alert prob with ajax.. can means help me..
#12
Re: alert problem in c# asp.net
Posted 19 April 2011 - 08:56 PM
hi marinus.. suddenly your code myBody.Attributes.Add("onload","alert('hello');");
is not working i do the reason again am hav same prob if alert comes my background pic disappear till alert close.
is not working i do the reason again am hav same prob if alert comes my background pic disappear till alert close.
#13
Re: alert problem in c# asp.net
Posted 27 April 2011 - 03:32 AM
That's weird because onload works after html page has been loaded ,
As you can see here what i mean
http://stackoverflow...after-page-load
have you fixed this ??
As you can see here what i mean
http://stackoverflow...after-page-load
have you fixed this ??
This post has been edited by marinus: 27 April 2011 - 03:36 AM
#14
Re: alert problem in c# asp.net
Posted 28 April 2011 - 01:30 AM
No not yet finished man
#15
Re: alert problem in c# asp.net
Posted 28 April 2011 - 01:35 AM
I couldn't understand that in stackoverflow
|
|

New Topic/Question
Reply



MultiQuote




|