Monday, March 26, 2012

ConfirmButtonExtender,Please Help Me

Hi,

I have a problem in ConfirmButtonExtender.

I am using ConfirmButtonExtender and when i run it,it pop up the Confirm Dialog with OK and CANCEL Button.

So,I need the value or Id of OK and Cancel Button.

My Code:

<Ajax:ToolkitScriptManager ID="ScrMgr" runat="server" EnablePartialRendering="true" />
<div>
<asp:Button ID=btn runat=server Text=Redirect OnClick="btn_Click1" />
<Ajax:ConfirmButtonExtender ID="confirm"
runat="server"
OnClientCancel="0"
ConfirmOnFormSubmit="false"

ConfirmText="Are you sure want to redirect?"
TargetControlID="btn">
</Ajax:ConfirmButtonExtender>

</div>

How can i do this?

Please Help..

By:Vasu

If you click on OK it returns true otherwise it returns false.

can you tell me why you need ID of that button?


Hi,

I'm not sure why you want to achieve this too. But you can use the following method:

1. Add a modalPopupExtender and corresponding panel with ok & cancel button in it to the page

2. Use this modalPopup instead of default confirm window by setting DisplayModalPopupID property to the modalPopupExtender's id

<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
TargetControlID="LinkButton" BehaviorID="cbe"DisplayModalPopupID="aaa"
ConfirmText="Are you sure you want to click the LinkButton?"
OnClientCancel="cancelClick" />

3. Get ok & cancel button's id via

$find($find("cbe").get_displayModalPopupID()).get_OkControlID() / get_CancelControlID()

No comments:

Post a Comment