• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3220
  • Last Modified:

confirm does not work with infragistics webimagebutton

Hi experts,

I am wotking on infragistics webimagebutton, and i need to have a comfirm dialog box on that button.

It have used a function foo() to the clientsideevents.click

In that function i have a some code from which i get the message that has to be shown in the confirm dialog box. At the end of the function, i used this code

return confirm(strReturn)
--strReturn is my message

when i click the button, i get the confirmation box but it postbacks even if cancel is clicked.

Is it something to do with the infragistics??

One more thing, webimagebutton has a property called "AutoSubmit". I tried setting that to false.
If i do that, my confirm box pops up many number of times (6 i think) and even if i click ok, it never submits the page.

Could somebody help me out please?

Regards
0
Raju Srivatsavaye
Asked:
Raju Srivatsavaye
3 Solutions
 
archrajanCommented:
try to make the image a non submit button

something like this

<img src = "abc.gif" onclick = "dosub();">

function dosub()
{
if(confirm("your message"))
document.formname.submit();


}
0
 
knightEknightCommented:
or you can do it in the <form> tag:

<FORM name="myform" action="myaction" onsubmit="return confirm('Are you sure?');" >
0
 
xlt77Commented:
Confirm returns boolean value. Pressing ok button returns true, pressing cancel button or close the dialog directly returns false. so

function foo()
{
  if (confirm("your message"))
  {
    //Here do something
    return true
  }
  else
  {
    //Here do other things
    return false
  }
}

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Raju SrivatsavayeSoftware EngineerAuthor Commented:
Hi guys,

Now forget about the infragistics. I was just testing using a normal ASP.NET 2.0 button

This code works

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return confirm('Do you really want to delete this row? No undo action is available')" />

but when i use the code below, i am getting the confirm dialog box but even if i click cancel the form is getting submitted.

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:foo()" />

<script type="text/javascript">

    function foo()
    {
           return confirm('Do you really want to delete this row? No undo action is available')
     }
</script>

Do you know what is the difference?

Raj
0
 
Raju SrivatsavayeSoftware EngineerAuthor Commented:
never mind,

dont think about the last post
i was wrong

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:foo()" />
 should be

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:return foo()" />
0
 
Raju SrivatsavayeSoftware EngineerAuthor Commented:
Hi guys,

I gave up and i am using a Image button (microsoft) instead of infragistics.
thanks for the help anyways

i ll split the points evenly between u three

Thanks
Raj
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now