473,795 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Confirm problem

Hi
am having some problems with the javascript confirm.
i have it working fine on one page and it doesnt even pop up at the
other.

The code on the working page is,

private void Page_Load(objec t sender, System.EventArg s e)
{
if(! Page.IsPostBack )
{
DataSet _DSSections =
VariableHandler .GetInstance(). FetchAllVariabl es();
if (_DSSections.Ta bles[0].Rows.Count > 0)
{
lblInstructions 1.Visible = true;
btnEdit.Visible = true;
btnDelete.Visib le = true;
btnDelete.Attri butes.Add("OnCl ick","JavaScrip t:return confirm('Do
you wish to delete the selected variable');");
GrdVariableList .DataSource = _DSSections;
GrdVariableList .DataBind();
}
}
}
The one not working has the same javascript in the same way.

but it doesnt work. Other alerts on the page are showing up. but the
confrim isnt.

When i viewed the source of both the pages i found the following
diference

working:
<input type="submit" name="btnDelete " value="Delete Selected"
onclick="if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date(); " language="javas cript" id="btnDelete"
OnClick="JavaSc ript:return confirm('Do you wish to delete theselected
variable variable');" style="height:2 9px;width:100px ;" />&nbsp;
Not Working:
<input type="submit" name="btnDelete " value="Delete Selected"
id="btnDelete" OnClick="JavaSc ript:return confirm('Do you wish to
delete the selected variable');" style="height:2 9px;width:100px ;"
/>&nbsp;
i have no idea when the "iftypeof" thing was added in the first code
and why wasnt it added in the second one.

kindly help me out of this.
thnkx
MA
Nov 18 '05 #1
1 2651
if you have any custom validation, asp.net throws some client side scripts
to do the validation. thats why you see if(istypeof()) stuff..

but coming to your problem, u mentioned the second peice of code is not
working..infact that should be the one working. and first should not.

when i tried without any custom validators on the page, it gave me the
output like in the second piece of code. it worked.

when i tried with custom validator on the page, it gave me this output which
is correct.
onclick="javasc ript:return confirm('do you want to delete?');if
(typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); "

Av.

"Muhammad Abdullah" <ab************ **@yahoo.com> wrote in message
news:c2******** *************** ***@posting.goo gle.com...
Hi
am having some problems with the javascript confirm.
i have it working fine on one page and it doesnt even pop up at the
other.

The code on the working page is,

private void Page_Load(objec t sender, System.EventArg s e)
{
if(! Page.IsPostBack )
{
DataSet _DSSections =
VariableHandler .GetInstance(). FetchAllVariabl es();
if (_DSSections.Ta bles[0].Rows.Count > 0)
{
lblInstructions 1.Visible = true;
btnEdit.Visible = true;
btnDelete.Visib le = true;
btnDelete.Attri butes.Add("OnCl ick","JavaScrip t:return confirm('Do
you wish to delete the selected variable');");
GrdVariableList .DataSource = _DSSections;
GrdVariableList .DataBind();
}
}
}
The one not working has the same javascript in the same way.

but it doesnt work. Other alerts on the page are showing up. but the
confrim isnt.

When i viewed the source of both the pages i found the following
diference

working:
<input type="submit" name="btnDelete " value="Delete Selected"
onclick="if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date(); " language="javas cript" id="btnDelete"
OnClick="JavaSc ript:return confirm('Do you wish to delete theselected
variable variable');" style="height:2 9px;width:100px ;" />&nbsp;
Not Working:
<input type="submit" name="btnDelete " value="Delete Selected"
id="btnDelete" OnClick="JavaSc ript:return confirm('Do you wish to
delete the selected variable');" style="height:2 9px;width:100px ;"
/>&nbsp;
i have no idea when the "iftypeof" thing was added in the first code
and why wasnt it added in the second one.

kindly help me out of this.
thnkx
MA

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5079
by: cheezebeetle | last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when they press "Cancel" they call another ASPX function. My code now is: System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf) System.Web.HttpContext.Current.Response.Write("if (confirm('Are you sure you want to...
14
5486
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
6
1945
by: tshad | last post by:
I am trying to set up a Javascript popup box that has a way of sending back a message to asp.net on how to process some data. At the moment I am just doing: myNextButton.Attributes.Add("onclick", "return confirm('Are you sure you want finish this test?');") to attach a popup box to a button. The problem is that the buttons only say OK and Cancel. OK will take me to the event tied to the button and Cancel,
9
4923
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
12
2138
by: tshad | last post by:
I have the following code that attaches a Javascript confirm box to my checkbox. When I select the checkbox, the window comes up fine, but it never executes the XfertoDefault_Click function when I press the Yes button. If I take off the Javascript event, the checkbox works fine. XferToDefault.Attributes.Add("onclick", "return confirm('Are you sure you want copy these entries?');") <asp:CheckBox ID="XferToDefault" AutoPostBack="true"...
3
4521
by: TJ | last post by:
Hi, I would like to ask something to user after user submits the form... I know I can ask user whehter they want to submit the form or not using client-script code such as onClick or onSubmit by adding into attributes collections... My problem is a little bit different than that... I would like to ask user something after submission is done
8
4034
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form has a Button. When the Button is clicked, I want a JavaScript confirm dialog to pop-up with the options 'OK' & 'Cancel'. I have done this using the following code: Sub Page_Load(....) btnClick.Attributes.Add("OnClick", "javascript:return...
6
3287
by: Peter Afonin | last post by:
Hello, I'm creating an application in ASP.NET 1.1. I need to check whether at least one checkbox in my datagrid has been checked. To do this, I'm using Javascript - I'm adding this code to Page_Load event: Dim iCount As Int32 Dim sClientSideValidate As New StringBuilder iCount = dgReport.Items.Count For i As Int32 = 2 To iCount + 1
0
9672
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.