Skip to main content

Posts

Showing posts from January, 2015

Solved: Default filters lost on rebind of Telerik MVC Gridview.

Problem: While working with MVC Telerik GridView let’s say you have some default filters using Filterable, as mentioned in below code:
@(Html.Telerik().Grid(Model)     .Name("testGrid")     .Columns(c =>             {                 c.Bound(m => m.Id).Width(30);                 c.Bound(m => m.Name).Width(110);                 c.Bound(m => m.Telephone).Width(100);                 c.Bound(m => m.IsActive).Width(100);             })     .DataBinding(dataBinding =>             {                 dataBinding.Ajax().Select("<Action-Name>", "<Controller-Name>", new { id = Guid.NewGuid().ToString() });
            })         .Sortable()         .Pageable(paging => paging.PageSize(100))         .Filterable(filtering => filtering                     .ShowOrOption(true)                     .Filters(filters => filters.Add(T => T.IsActive).IsEqualTo("Yes")))         .Selectable() )
And suppose there is one s…

How do I add inverted commas or quotes in strings in JavaScript or JQuery?

While working with client scripting every now and then one may face challenge to add inverted commas or quotes in strings. We can add inverted commas or quotes proceeding by a backslash character. This allows the JavaScript interpreter to differentiate a quote within the string from the quotes that serve as string delimiters.
Let’s see an example: testString1 = 'It\'s one o\'clock!'; testString2 = "<a href=\"testpage.html\">";
Alternatively, if string includes single quotes only, then you can use double quotes as string delimiters, and vice versa, as mentioned in below example. testString1 ="It's one o'clock!"; testString2 ='<a href="testpage.html">’;