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

RadGrid ColumnType

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keshav
Top achievements
Rank 1
Keshav asked on 22 Sep 2014, 09:09 AM
Hi All ,

How to get the column type of a column of radgrid in javascript ?
I need to remove few filter options for 'GridDateTimeColumn'.
So I need to get the column type of the column in 'On Client Showing' event.

Any other way to acheive the same would be appreciated.

Thank you,
Anurag

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 25 Sep 2014, 06:34 AM
Hello Anurag,

Once you get reference to a specific column you can use the following approach for retrieving its type:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function pageLoad() {
            var grid = $find("<%=RadGrid1.ClientID%>");
            var someColumn = grid.get_masterTableView().getColumnByUniqueName("Id");
            var columnType = someColumn._data.ColumnType;
        }
    </script>
</telerik:RadCodeBlock>

As for reducing filter options, please take a look at the following help article, where in the first part in the JavaScript tab you can see how this could be accomplished, depending on a condition:
Hope this help.



Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Keshav
Top achievements
Rank 1
answered on 26 Sep 2014, 05:01 AM
Hi Konstantin ,

This works fine. Thank you.
But I am facing another issue with filtering datetimecolumn. I am changing the format to dd-MMM-yyyy (as required in the database) and sending to stored proc. But donot get any data in the readgrid although the same filter works fine when used in sql server as parameter to that particular stored proc.

Regards,
Anurag
0
Konstantin Dikov
Telerik team
answered on 30 Sep 2014, 08:16 AM
Hello Anurag,

GridDateTimeColumn is designed to be used with DateTime objects only. This means that the DataField set to the column must be of DataTime type. The same applies for the underlying column in the database.

Can you please confirm that you are using DateTime objects?

If you continue to experience problems with this, please provide the markup and the relevant part of your code-behind, so we can familiarize with your exact implementation.


Best Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Keshav
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Keshav
Top achievements
Rank 1
Share this question
or