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

Default Text for Filter Column RadGrid

0 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francisco Gonzalez
Top achievements
Rank 1
Francisco Gonzalez asked on 04 Jun 2010, 06:03 PM
this little piece of code is make in jQuery, for put a default text in filter column, when filter got focus, the text empty.
$(document).ready( function() 
        { 
            var filtros = $("input[class='rgFilterBox']"); 
             
            if(filtros.length > 0) 
            { 
                var textoFiltro = document.getElementById("<%= hdFiltro.ClientID %>").value; // Text show
                for(var i=0; i<filtros.length; i++) 
                { 
                    if(filtros[i].value == ""
                    { 
                        filtros[i].value = textoFiltro; 
                        filtros[i].style.color = "#d6d6d6"
                    } 
                     
                    filtros[i].onfocus = function() { 
                        if(this.value==textoFiltro)  
                        { 
                            this.value = ""
                            this.style.color = "black"
                        } 
                    } 
                 
                    filtros[i].onblur = function() { 
                        if(this.value == ""
                        { 
                            this.value = textoFiltro; 
                            this.style.color = "#d6d6d6"
                        } 
                    } 
                } 
            } 
         }); 
Sorry, my english is poor,

Happy coding.

GDEx

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Francisco Gonzalez
Top achievements
Rank 1
Share this question
or