By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,823 Members | 756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,823 IT Pros & Developers. It's quick & easy.

Javascript Confirm problem

P: n/a
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(object sender, System.EventArgs e)
{
if(! Page.IsPostBack)
{
DataSet _DSSections =
VariableHandler.GetInstance().FetchAllVariables();
if (_DSSections.Tables[0].Rows.Count > 0)
{
lblInstructions1.Visible = true;
btnEdit.Visible = true;
btnDelete.Visible = true;
btnDelete.Attributes.Add("OnClick","javascript:ret urn 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_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript" id="btnDelete"
OnClick="javascript:return confirm('Do you wish to delete theselected
variable variable');" style="height:29px;width:100px;" />&nbsp;
Not Working:
<input type="submit" name="btnDelete" value="Delete Selected"
id="btnDelete" OnClick="javascript:return confirm('Do you wish to
delete the selected variable');" style="height:29px;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
Share this Question
Share on Google+
1 Reply


P: n/a
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="javascript:return confirm('do you want to delete?');if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "

Av.

"Muhammad Abdullah" <ab**************@yahoo.com> wrote in message
news:c2**************************@posting.google.c om...
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(object sender, System.EventArgs e)
{
if(! Page.IsPostBack)
{
DataSet _DSSections =
VariableHandler.GetInstance().FetchAllVariables();
if (_DSSections.Tables[0].Rows.Count > 0)
{
lblInstructions1.Visible = true;
btnEdit.Visible = true;
btnDelete.Visible = true;
btnDelete.Attributes.Add("OnClick","javascript:ret urn 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_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript" id="btnDelete"
OnClick="javascript:return confirm('Do you wish to delete theselected
variable variable');" style="height:29px;width:100px;" />&nbsp;
Not Working:
<input type="submit" name="btnDelete" value="Delete Selected"
id="btnDelete" OnClick="javascript:return confirm('Do you wish to
delete the selected variable');" style="height:29px;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 discussion thread is closed

Replies have been disabled for this discussion.