Showing posts with label buttons. Show all posts
Showing posts with label buttons. Show all posts

Wednesday, March 28, 2012

Control inside a DropDownList

Hi,

Is it possible to insert controls such as buttons, etc... inside a dropdownlist ?

hello.

not inside the traditional dropdownlist. i guess that you could fake it though by using javascript...


thank you

Monday, March 26, 2012

ConfirmButtonExtender inside Gridview only fires from the first row

I have a gridview, with more than 1 row and the first column is a template in which I have the normal two command buttons Delete and Cancel. Within this template, I have also put a ConfirmButtonExtender for the Delete button to give the user an extra out.

The problem I am having is that the ConfirmButtonExtender only fires for the first row but it does not show up for the subsequent rows. When I click the Delete button for the second row, delete the row is exactly what it does.. without asking if I want to or not as I had set up.

I am wondering if anyone else had the same problem, couldn't find anything online.

Thanks in advance.

Hi

The following works just fine with me,
each button-click (on each row) triggers the confirm message.

 <asp:TemplateField HeaderText="confirm"><ItemTemplate> <asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="Button" /> <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button4"> </cc1:ConfirmButtonExtender></ItemTemplate> </asp:TemplateField>

Please try to replicate the behavior you have ina working code example !
Then I can easily look into it!

Kind regards,
Wim

ConfirmButtonExtender and Validation

I am using theConfirmButtonExtender on a button that has CauseValidation=true.

The button's confirmation alert pops-up even when the page is (not) valid, so the user sees it every time they do not fill out a control properly and submit.

Am I missing a setting or was this extender written regarless of validation controls and page validaty?

Alternatives?

Hi Jjmonty,

My understanding of your issue is that you want to show the ConfirmButtonExtender based on the page validation. If I have misunderstood, please feel free to let me know.

It is a design pattern rather than your code problem. To achieve what you want , we can set the ConfirmButtonExtender's TargetControl to a hidden Button. When we click on the fake Button , it will call a javascript function. The javascript function will first validate the inputs them fire to show the ConfirmButtonExtender . Here is the test sample.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator> <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure to submit?"TargetControlID="Button1"> </ajaxToolkit:ConfirmButtonExtender> <div style="display:none"> <asp:Button ID="Button1" runat="server" Text="Button" /> </div><input id="btnFake" type="button" value="Submit" onclick="toSubmitForm()" /> <script language="javascript"> function toSubmitForm(){if(typeof(Page_ClientValidate)=='function'){ if(Page_ClientValidate()) { $get("<%=Button1.ClientID%>").click(); } } } </script> </form></body></html>

Best regards,

Jonathan

ConfirmButton and disabled controls

I've noticed that ConfirmButton reacts on clicking on disabled (Enable = false;) buttons.
Sometimes U don't want to see confirm dialog when clicking the button is disabled.
One small modification in .js does the job (one condition when binding onclick handler) but it would by nice to have it the toolkit.

Good point - I'll add a work item for that. Thanks!
Note this is WorkItem 1482.

Saturday, March 24, 2012

Confirm Button Extension with Wizard buttons?

Hi

I would like to use the AJAX confirm button extension, but I am trying to attach it to the "FinishButton" that is automatically created with the ASP Wizard.

So in a nutshell when a user clicks the "finish" button in my wizard a message box will pop up asking the user if they are sure they would like to continue.

I'm using VWD2005 express and scripting in visual C#.

Please can someone help me out or point me in the right direction?

Cheers!!!

Hi

I managed to solve this one! Woooohoooo.

If anyone is interested then here's my ASP. You need to put the button extended inside the Finish Navigation Template itself.

<FinishNavigationTemplate>

<cc1:ConfirmButtonExtenderID="ConfirmButtonExtender1"runat="server"TargetControlID="FinishCompleteButton"ConfirmText="Are you sure you want to place this order?">

</cc1:ConfirmButtonExtender>

<asp:ButtonID="FinishPreviousButton"runat="server"Text="Previous"CommandName="MovePrevious"/>

<asp:ButtonID="FinishCompleteButton"runat="server"Text="Finish"OnClientClick="Wizard1_FinishButtonClick"CommandName="MoveComplete"/>

<asp:ButtonID="CancelButton"runat="server"Text="Cancel"CommandName="Cancel"/>

</FinishNavigationTemplate>

Conditional ConfirmButtonExtender

Hi!!

Just wondering if this was possible...

I've got some buttons that sometimes I want to confirm, and at other times I don't. For example, if I'm taking an order for a certain quantity (e.g. 1,000) I might want to confirm that the user is happy with this, whereas if it's for a low amount (e.g. 1 or 2) I don't need to confirm this.

Has anyone got any ideas how to achieve this with the confirmButtonExtender, or is it a case of writing manual javascript and using the OnClientClick property of the asp:Button?

Many thanks in advance for your help!

Regards,

James

I'm thinking you might modify a customized ConfirmButton slightly so that it knows to look at some page state (JS variable, element value, etc.) before displaying the confirm dialog. Shouldn't be much more than an additional line or two, I'm not thinking...