Hi All,
Firstly, I apologise if this question has appeared before but I can't find it anywhere.
I have created a gridview with two command buttons. When I click the buttons I want either an alertbox or confirm box to appear.
The problem I am receiving is when I click the command button the page disappears, a JavaScript alert box appears, you click OK on the alert box and the page reappears but all the CSS formatting has gone so my DIV tags and text all revert back to normal.
Can anyone tell me how to prevent this, or get an alertbox to appear with the page still showing in the background???
Many thanks,
Gwyn
16 8729 gits 5,390
Expert Mod 4TB
hi ...
could you please post your code or give a link to a testpage? ... is the page refreshed (posted to the server) during the operation?
kind regards
Thanks for replying...
The CSS I'm using is... - body
-
{
-
border-top: solid 5px #BF2028;
-
border-left: solid 1px #BF2028;
-
border-right: solid 1px #BF2028;
-
border-bottom: solid 1px #BF2028;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
margin: 2px;
-
padding: 0px;
-
}
-
-
#header
-
{
-
background: #FFFFFF;
-
border-bottom: solid 2px #BF2028;
-
width: 100%;
-
height: 64px;
-
}
-
#content
-
{
-
background: #FFFFFF;
-
float: left;
-
width: 100%;
-
height: 100%;
-
}
-
#footer
-
{
-
background: #EEEEEE;
-
border-top: solid 1px #BF2028;
-
clear: both;
-
width: 100%;
-
height: 12px;
-
text-align: center;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: xx-small;
-
color: #BF2028;
-
vertical-align: text-bottom;
-
}
-
#loginLine
-
{
-
width: 100%;
-
height: 18px;
-
text-align: right;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
border-bottom: dotted 1px #BF2028;
-
margin-right: 15px;
-
}
-
#searchTabPanel
-
{
-
width: 100%;
-
height: 110px;
-
text-align: left;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
border-bottom: solid 1px Gray;
-
}
-
#searchDisplay
-
{
-
padding: 10px;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
width: 100%;
-
height: 80%;
-
}
-
-
#searchButtonRow
-
{
-
padding: 5px;
-
text-align: right;
-
height: 25px;
-
width: 99%;
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
border-bottom: dotted 1px #BF2028;
-
}
-
-
.tpTotalWidth
-
{
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: small;
-
color: #333333;
-
width: 90%;
-
height: 80%;
-
}
-
-
.tpLeftBlock
-
{
-
float: left;
-
padding: 15px;
-
width: 40%;
-
height: 50%;
-
}
-
-
.tpRightBlock
-
{
-
float: left;
-
padding: 15px;
-
width: 40%;
-
height: 50%;
-
}
-
-
.tpBigBlock
-
{
-
float: left;
-
padding: 10px;
-
width: 75%;
-
height: 50%;
-
}
This is used in the following HTML...
I'm sorry this is a bit long but I don't think I can cut it down anymore and still show the relevant parts. All the processing is done in code behind.
The page does postback when the play or delete button in the gridview is pressed. If the code behind can't find the associated file then the alert box appears and after clicking ok the screen comes back wierd!
Any helpful suggestions you have would be most appreciated.
Many thanks,
Gwyn
gits 5,390
Expert Mod 4TB
i don't find the alert() .... how do you generate the alertbox?
I'm sorry...I do that in the code behind...
Public Sub DisplayAlert(ByVal msg As String)
Response.Write("<script language=JavaScript> alert('" & msg & "'); </script>")
End Sub
Ideally, I would like you of the boxes to be a confirm type but can't find any code to do this in code behind and be able to retrieve the return value, ok or cancel, and continue processing based on that value.
gits 5,390
Expert Mod 4TB
so that is an entirely serverside problem ... as far as i understand you have an asp-page ... the user makes a decision and the page is posted back to the server where you validate the action and write an alert mesage to the page when there was a wrong action taken by the user before. may be when you use: - Response.Write("<script type=\"text/javascript\"> window.onload = function() { alert('" & msg & "'); };</script>");
it works as you expect? with that the message should be displayed when the page is fully loaded to the client ...
kind regards
I'll give that a try and see what happens.
Many thanks again and I'll let you know if it sorts it out.
Gwyn.
It doesn't quite do it...
The page posts back and then reloads with the alert box on top but the text size and font have changed. As you can see from the CSS above I am using Small Arial font but when it comes back it is medium or large and looks like Times.
When the page is reposted when I click on another button that causes a postback the text returns to normal???
Is there a simple way to trigger a postback?
Thanks
Gwyn
gits 5,390
Expert Mod 4TB
i wonder about this problem ... in case you remove the alert everything works fine?
Yes, you just don't get informed when there is a problem retreiving or deleting a file.
I have also now noticed that when the page is in this state (after the alert box with the larger text) that if I click another button, or the same one again that I don't get the alert box at all until the page has been reset back to the initial state.
Any ideas?
gits 5,390
Expert Mod 4TB
Yes, you just don't get informed when there is a problem retreiving or deleting a file.
I have also now noticed that when the page is in this state (after the alert box with the larger text) that if I click another button, or the same one again that I don't get the alert box at all until the page has been reset back to the initial state.
Any ideas?
sure ... since we have added it to the documents onload-handler that is only called when the page is (re)loaded ... but to me that seems a very strange problem ... what happens when you put the following in the body? - <body onload="alert('test');">
and remove the other alert for testing purposes.
kind regards
I'll have to give this a try tomorrow as it's time to go home!!! Yay!
I will try it out and let you know.
Many thanks for all your efforts this afternoon, I really appreciate it.
Gwyn.
Hi,
Thanks again for the help the other day.
I implemented that onload alert in the body as you suggested and that has no affect on the font style at all???
I'm beginning to think that perhaps it is the use of javascript attached to a command button within a Gridview.
I might try changing it to a template column and doing it that way and see what happens unless you have a better suggestion?
Thanks again,
Gwyn
Template fields are not the solution as I need to back end processing on the information and therefore use the RowCommand and more specifically the rowindex value provided by it and Template fields don't seem to be able to pass this value, only button fields.
Damn!
gits 5,390
Expert Mod 4TB
hmmm ... sadly i'm not very familiar with asp so i cannot really say that there could be a problem with javascript-code ... but it would be very strange in case it would :) ... as far as i understood the problem now we have the following:
1. page is completely rendered through asp and delivered correctly
2. client renders it correctly and user takes an action
3. asp recieves the action and identifies an error with the user's action
3.1. asp writes an alert to the page
now: is the page precessed completly and then send back to the client? or immediatly after adding the alert? it should be send completely ... in case you have a look at the source-code when it is sent back to the client ... is that complete?
kind regards
Yes, once the button in the gridview is clicked the code behind processes the request and if a matching file exists it is played, if not, the alert box is shown on the page being re-loaded. At this point the text comes back a different size behind the alert box.
On clicking one of the other buttons on the form which causes a postback the text is returned to normal.
Please remove where you write Response.Write(message)
instead of this use
message= "r u ok";
ScriptManager.RegisterClientScriptBlock(this,
this.GetType(), Guid.NewGuid().ToString(), message,true);
respoce.write causing the problem
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andy Fish |
last post by:
Hi,
I want to use an anchor tag to invoke some javascript and I've read that
it's bad form to use <a href="javascript:foo()">
I've read endless usenet posts and hint sites on the net, they all...
|
by: tshad |
last post by:
I have a function:
function SalaryDisplay(me)
{
var salaryMinLabel = document.getElementById("SalaryMin");
salaryMinLabel.value = 200;
alert("after setting salaryMinLabel = " +...
|
by: Bazza Formez |
last post by:
Hi,
I have an app which utilizes forms security. I have a Login.aspx page
which references my MasterPage.master. The master page in turn
references a css.
In the designer of VS 2005, the...
|
by: 9icj4u613jeqrx8 |
last post by:
Hi,
I need some help with IE browser programming (in .NET).
I'm trying to add a button to the IE toolbar, and on the click of the
button open a popup window with a remote URL. Secondly, I'm...
|
by: e_spork |
last post by:
I am using Page.ClientScript.RegisterStartupScript to throw up a
Javascript alert box. When I click OK on the alert box, all the
controls on my page disappear and I don't understand why. I can...
|
by: sara |
last post by:
Hi -
I have a report that is 14 columnar sub-reports (Line up: Position-
holders in each of our 14 locations - Manager, Assistant Manager,
Receiving, Office, etc).
I output directly to PDF...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |