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

Textbox firing validators inside RAD Grid

1 Answer 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kishan Gandikota
Top achievements
Rank 1
Kishan Gandikota asked on 07 Nov 2009, 05:04 PM
Hi Telerik Team,

Product that we are developing requires RAD Grid and a text box inside the grid. What we are doing is to have a asp:Textbox with GridTemplateColumn added.

<telerik:GridTemplatecolumn>
<asp:Textbox id="txtUser" runat="server" Text='<%#Bind("UserInfo")%'  OnTextChanged="txtUser_TextChanged"/>
<asp:RequiredFieldValidator id="revTxtUser" runat="server" ControlToValidate="txtUser" ErrorMessage="User Info is blank" />
</telerik:GridTemplatecolumn>


Please note that this textbox has a required field validator. We don't want a edititemtemplate rather a textbox pre-filled with values (UserInfo) from datasource. When user changes the text inside a textbox, my OnTextChanged event gets fired.

We have a scenario where the data coming the datasource for UserInfo is blank. In the same page, we have a button that will do the postback. During this time, my requiredFieldValidator is not getting fired. I will also have RegularExpressionValidator with this textbox. Even this need to be fired.

Is there any way to fire this client side validator. I tried setting ValidationGroup also. It didn't work out. Worst solution here would be to use asp:CustomValidator and do the validation at the server side. But I wan't to keep this as the last option.

Could you please guide me on how to fire these validators? Is there a way to fire these validators?

Regards,
Kishan G K

1 Answer, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 12 Nov 2009, 09:38 AM
Hi Kishan,

If I understand your scenario correctly you want to use a RegularExpressionValidator to validate an empty TextBox on the client. In the same time you have a RequiredFieldValidator validating the same textbox that you do not want to fire. This scenario is quite strange to me. Why don't you just use the RequiredFieldValidator for empty string validation and the RegularExpressionValidator for any other purposes? In this case all you have to do is to ensure that your browser supports the client side validation.

I hope this helps,
Johny
Tags
Grid
Asked by
Kishan Gandikota
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Share this question
or