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

filter float format

3 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JJ
Top achievements
Rank 1
JJ asked on 28 May 2013, 07:44 PM
When using radgrid filter like below, if the bound column is float, the filter has "0.00" as defaut value, is there anyway can have blank in the filter instead of "0.00"?

http://demos.telerik.com/aspnet-ajax/filter/examples/overview/defaultcs.aspx

Thanks

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 May 2013, 08:48 AM
Hi JJ,

Please have a look at the following JavaScript I tried which works fine at my end.

JavaScript:
<script type="text/javascript">
    function pageLoad() {
        var input = document.getElementById("<%= RadFilter1.ClientID %>").getElementsByTagName("input")[0];
        input.defaultValue = " ";
    }  
</script>

Thanks,
Shinu.
0
JJ
Top achievements
Rank 1
answered on 29 May 2013, 03:38 PM

 

Thank Shunu.

My case is I am using filtercontrol which as a radwindow on if for the filter, this filtercontrol -radwinodow is shared by all the grid on the site, on parents page (which has the grid) pass the gridid to the filer control.

like this demo:
http://demos.telerik.com/aspnet-ajax/filter/examples/filterinradwindow/defaultcs.aspx

 

Is there anyway on the radwindow to check the passing grid to see if data type is integer or float, show blank instead of 0.00? Since the radfilter in radwinodw is shared for all the grid, not good for me to use document.getElementById.


Thank you,

0
Eyup
Telerik team
answered on 31 May 2013, 08:23 AM
Hi,

You can wait to the Q2 release of RadControls or download the Beta version and use the following event:
http://www.telerik.com/help/aspnet-ajax/filter-accessing-expression-items.html

Here is a practical example:
protected void RadFilter1_ExpressionItemCreated(object sender, RadFilterExpressionItemCreatedEventArgs e)
{
    RadFilterSingleExpressionItem singleItem = e.Item as RadFilterSingleExpressionItem;
    if (singleItem != null && singleItem.IsSingleValue)
    {
        RadNumericTextBox numBox = singleItem.InputControl as RadNumericTextBox;
        if (numBox != null && numBox.Value == 0)
        {
            numBox.Value = null;
        }
    }
}

Hope this helps.

Regards,
Eyup
Telerik
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
Grid
Asked by
JJ
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
JJ
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or