I have a TemplateField in my DataView that is used to hold a link button to remove the item from the list. I have added a ConfirmButtonExtender to the template as well, and it works the first time I click the linkbutton, and if I click Cancel it will keep poping up when I click any of the linkbuttons again, but if I click OK to remove the item, the next time I click on a link button the ConfirmButtonExtender doesn't pop up to confirm. Below is the code where it is implemented.
<asp:TemplateFieldHeaderText="">
<ItemTemplate><asp:LinkButtonID="lnkRemoveIngredient"runat="server"Text="Remove"CommandName="Remove"CausesValidation="false"></asp:LinkButton><ajaxToolkit:ConfirmButtonExtenderID="cbelnkRemoveIngredient"runat="server"TargetControlID="lnkRemoveIngredient"ConfirmText="Are you sure?"/></ItemTemplate>Just wondering if this is a known bug or if there is a way around this!
It always seems like I reply to my own posts, but I have approached this problem differently. Instead of using the ConfirmButtonExtender I have added a OnClientClick to the above mentioned linkbutton and the functionality works as desired.
<ItemTemplate>
<asp:LinkButtonID="lnkRemoveIngredient"runat="server"Text="Remove"CommandName="Remove"CausesValidation="false"OnClientClick="return confirm('Are you sure?');"></asp:LinkButton></ItemTemplate>Easy enough... but still interested in why the ConfirmButtonExtender acts up in this scenario
Sounds kind of like:http://forums.asp.net/thread/1441672.aspx?
No comments:
Post a Comment