0

When I click on Image button , I get a confirmation pop up to select either Yes or No.

After clicking Yes, I want to call a function : objOwn.CloneIssue(Eval("id_tbl_issue"))

Can you please suggest how to do it .

My code so far:

<ItemTemplate>
   <asp:Imagebutton ToolTip="Clone this Issue." Text='Click' ID="hpr_link_edit" 
                    ImageUrl="~/Images/clone.png" CssClass="textbox" runat="server" 
                    OnClientClick="return confirm('Clone?');" /> 
</ItemTemplate> 
Stephan Bauer
  • 9,120
  • 5
  • 36
  • 58
Bharti Pandita
  • 291
  • 1
  • 3
  • 9

2 Answers2

1

You're almost there - the key thing is this line, which you've already figured out:

OnClientClick="return confirm('Clone?');"

If the confirm returns true then the method in the OnCommand property will execute. If the confirm returns false then nothing will happen.

All you need to do is add an OnCommand property, specifying the associated handler method in the code behind (which should then call your clone code).

If you want to pass the id_tbl_issue value through to the handler, you could put it into a CommandArgument property, as in this question. Obviously you will need to swap LinkButton for your ImageButton:

OnCommand="YourMethodName" CommandName="Clone" CommandArgument='<%# Eval("id_tbl_issue") %>'

To understand how to create the handler, have a look at http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.oncommand(v=vs.110).aspx. Unfortunately I'm a C# developer so I'm not really familiar with the VB.NET syntax.

Community
  • 1
  • 1
Sir Crispalot
  • 4,792
  • 1
  • 39
  • 64
0

My code is this:-

Response.Write("<script>var confirmdelete=confirm('No chronological event found.Do you want to continue ?');if (confirmdelete) {('<%=ASPxButton_Approve%>').valueof()}</script>");

After I click approve button it will show yes no confirmation box. It is showing but my problem is I want to call method "approve()" after user click YES from confirmation box.

noufalcep
  • 3,446
  • 15
  • 33
  • 51
Syed Hasan
  • 11
  • 1