Hi,
I have a template column for ProductId which is of type "int". I defined it as <telerik:GridTemplateColumn> I have some limitation ths why i can not make it <telerik:GridNumericColumn>.How can i validate the data type(so that user can not enter any character in that) while user will type in Filter text box like its happening for <telerik:GridNumericColumn> columns.
Regards,
Dheeraj
I have a template column for ProductId which is of type "int". I defined it as <telerik:GridTemplateColumn> I have some limitation ths why i can not make it <telerik:GridNumericColumn>.How can i validate the data type(so that user can not enter any character in that) while user will type in Filter text box like its happening for <telerik:GridNumericColumn> columns.
Regards,
Dheeraj
4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 14 Jun 2010, 02:44 PM
Hello Dheeraj,
Have you tried placing RadNumericTextBox in EditItemTemplate of grid?
aspx:
Thanks,
Princy.
Have you tried placing RadNumericTextBox in EditItemTemplate of grid?
aspx:
| . . . |
| <telerik:GridTemplateColumn> |
| <ItemTemplate> |
| <%# Eval("ContectNumber") %> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server"> |
| </telerik:RadNumericTextBox> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| . . . |
Thanks,
Princy.
0
Dheeraj
Top achievements
Rank 1
answered on 14 Jun 2010, 02:52 PM
Hi Princy,
Thanks for reply, but i am not asking about the textbox which appears on row edit.
I am asking about the Filter text box which we use to type expression(below the grid header). Here if we try typing any character for <telerik:GridNumericColumn> we will not be able to type. Same kind of validation for an integer column which is defined as
Thanks for reply, but i am not asking about the textbox which appears on row edit.
I am asking about the Filter text box which we use to type expression(below the grid header). Here if we try typing any character for <telerik:GridNumericColumn> we will not be able to type. Same kind of validation for an integer column which is defined as
<
telerik:GridTemplateColumn> how can we do.
Or is there any other way to validate data for template column which can avoid user typing Character in Integer datatype column.
Regards,
Dheeraj
0
Princy
Top achievements
Rank 2
answered on 15 Jun 2010, 07:15 AM
Hello Dheeraj,
You could use the RadNumericTextBox in FilterTemplate of GridTemplateColumn. Here is an example of what I tried in my application, where I used a NumericTextBox in FormTemplate.
aspx:
client code:
I hope this would clear the way to achieve your requirement.
Thanks,
Princy.
You could use the RadNumericTextBox in FilterTemplate of GridTemplateColumn. Here is an example of what I tried in my application, where I used a NumericTextBox in FormTemplate.
aspx:
| <telerik:GridTemplateColumn> |
| <ItemTemplate> |
| <%# Eval("OrderID")%> |
| </ItemTemplate> |
| <FilterTemplate> |
| <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server"> |
| <ClientEvents OnBlur="OnBlur" /> |
| </telerik:RadNumericTextBox> |
| <img src="../Images/Filter1.gif" onclick="filter();" /> |
| </FilterTemplate> |
| </telerik:GridTemplateColumn> |
client code:
| <script type="text/javascript"> |
| var value; |
| function OnBlur(sender, args) { |
| value = sender.get_value(); |
| } |
| function filter() { |
| if (value != null) { |
| tableView = $find('<%=RadGrid1.ClientID%>').get_masterTableView(); |
| tableView.filter("OrderID", value, "EqualTo"); |
| } |
| } |
| </script> |
I hope this would clear the way to achieve your requirement.
Thanks,
Princy.
0
Dheeraj
Top achievements
Rank 1
answered on 15 Jun 2010, 11:34 AM
Hi Princy,
Thanks a lot ,it worked fine for me.
One more question , I my grid I have a datetime column "OrderDate" .For this i am applying DataFormatString="{0:dd/MM/yyyy}" to show it in dd/MM/YYYY formate instead of default MM/dd/YYYY formate. Now on edit of row i am getting client side scipt error like -
" The string was not recognized as a valid DateTime."
I am using <telerik:GridEditCommandColumn> for inline editing
How to avod this error plz help me regarding this.Its urgent
Regards,
Dheeraj
Thanks a lot ,it worked fine for me.
One more question , I my grid I have a datetime column "OrderDate" .For this i am applying DataFormatString="{0:dd/MM/yyyy}" to show it in dd/MM/YYYY formate instead of default MM/dd/YYYY formate. Now on edit of row i am getting client side scipt error like -
" The string was not recognized as a valid DateTime."
I am using <telerik:GridEditCommandColumn> for inline editing
How to avod this error plz help me regarding this.Its urgent
Regards,
Dheeraj