This is a migrated thread and some comments may be shown as answers.

RadButton and AjaxControlToolkit

3 Answers 82 Views
Button
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 25 Jun 2012, 09:14 PM
Hi i have this validation


<asp:TextBox runat="server" ID="txbcantidad" CssClass="borde_txb" Width="45"></asp:TextBox>
<asp:RegularExpressionValidator
EnableClientScript="true"
SetFocusOnError="true"
ID="Regtxbcantidad"
Display="None"
ValidationGroup="valaccion_paso3_tab2"
runat="server"
ControlToValidate="txbcantidad"
ErrorMessage="Debe digitar números en el campo, sin caractéres especiales ni letras." ValidationExpression="^[0-9]*$">
</asp:RegularExpressionValidator>
<cc1:ValidatorCallOutExtender
CssClass="valtooltip"
PopupPosition="TopLeft"
WarningIconImageUrl="~/admin/img_alcalist/ico_alerta_val.gif"
CloseImageUrl="~/admin/img_alcalist/ico_cerrar_val.gif"
ID="Valtxbcantidad"
runat="server"
TargetControlID="Regtxbcantidad"
HighlightCssClass="campofallido" />

the textbox txbcantidad is in radgrid, this is the radbutton that activate the validation

 <telerik:RadButton ID="btnaccion2_paso3_tab2" runat="server" Skin="Office2010Blue" CssClass="txt11000" Text="Guardar Cambios" ValidationGroup="valaccion_paso3_tab2" CommandArgument="guardarref" OnCommand="realizaraccion"></telerik:RadButton>

my problem is that even if validation is enabled in the click event, the button causes postback and gets an error.

normal in this situation is that if the validation is enabled the button doesn't postback, how i fix this?

note that this controls are in a file ".ascx", which is called in a page ".aspx" that have one update panel. maybe this helps.

thanks.

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 27 Jun 2012, 12:25 PM
Hello Juan,

I'm going to ask a stupid question, but I just want to make sure I'm understanding when the validation fails.

In your textbox, you are entering something and then clicking the button, right? As the RegularExpressionValidator only validates when something is entered in the textbox. Or does the button still postback, even though you've entered invalid data?
0
Juan
Top achievements
Rank 1
answered on 29 Jun 2012, 01:43 PM
Hi Kevin

yes, the button does still postback even though you've entered invalid data. this is my problem and i don't know how to solve, help me please!

thanks.
Don't forget "this controls are in a file ".ascx", which is called in a page ".aspx" that have one update panel. maybe this helps"
0
Slav
Telerik team
answered on 03 Jul 2012, 01:25 PM
Hi Juan,

Please check the online demo Grid / Flexible Server-Side Validation. It shows how to implement validation in a RadGrid edit form. Note that the property EnableValidation of the RadGrid inner property EnableValidation should be set to true in order to enable the validation. I would suggest using this demo as a reference for achieving the desired functionality.
 
Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Button
Asked by
Juan
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Juan
Top achievements
Rank 1
Slav
Telerik team
Share this question
or