Monthly Archives: March 2015

Fixing the Telerik RadGrid Filter Case Sensitive Issue

By default the filter option for the RadGrid is set to be case-sensitive (true). You can change this on the .aspx page by specifying it tn the declaration of the grid.

GroupingSettings-CaseSensitive="False"
Advertisements
Tagged , ,

Reducing the Filter Menu Options in a Telerik RadGrid

You can reduce the filter menu options to display only a subset of the available filter functions. There are two possible approaches – client-side and server-side. I personally prefer the server-side approach and the following example shows how to reduce the set of filter functions so that the filter menu can only show the NoFilter, Contains, EqualTo, GreaterThan and LessThan items:

Private Sub RadGrid1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.Init
    Dim menu As GridFilterMenu = RadGrid1.FilterMenu
    Dim i As Integer = 0
    While i < menu.Items.Count
        If menu.Items(i).Text = "NoFilter" Or _
           menu.Items(i).Text = "Contains" Or _
           menu.Items(i).Text = "EqualTo" Or _
           menu.Items(i).Text = "GreaterThan" Or _
           menu.Items(i).Text = "LessThan" Then
            i = i + 1
        Else
            menu.Items.RemoveAt(i)
        End If
    End While
End Sub
Tagged ,

How to Reset Identity column in SQL Server

You might find the need to reset the identitity column count after deleting all records form a table or for any other purpose. The following code does just that!

DBCC CHECKIDENT('tablename', RESEED, 0)

Tagged

Twitter Bootstrap Modal immediately disappearing issue

If you face a  problem where, as soon as you click on the button for a modal popup, the modal fades in and then immediately disappears, then the problem is because this is typical behavior for loading the Modal plugin JavaScript twice. Please check to make sure that you have either bootstrap.js OR bootstrap-modal.js, but not both. The former includes the latter.

Tagged

Twitter Bootstrap CSS – box-sizing issue

Easiest Way

Safe only if you don’t use other bootstrap components Add the following css after the bootstrap css is loaded:

*,
*:before,
*:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

.container .row *,
.container .row *:before,
.container .row *:after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

This will use the border-box sizing only for elements within the grid system. This won’t work if you have custom widgets within the grid as they would still have border-box applied.

More targeted approach

Safe only if you don’t use other bootstrap components Alternatively, you could add a custom col class to every column div which already have a col-*-*applied like so:

<div class="container">
    <div class="row">
        <div class="col-md-3 col">Grid still works</div>
        <div class="col-md-9 col">:)</div>
    </div>
</div>

Then use the following css instead:

*,
*:before,
*:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

.container .row .col,
.container .row .col:before,
.container .row .col:after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

This works fine if you ONLY need to use the bootstrap grid system in your project. If you intend to use other bootstrap components however, I don’t recommend this approach either since other bootstrap components would depend on the border-box being set.

Cherry-pick each containing element to fix

A still better way would be to just override the box-sizing as content-box on a specific parent element for a widget like this:

.your-custom-widget-class *,
.your-custom-widget-class *:before,
.your-custom-widget-class *:after {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}

This approach offers the best forward compatibility with future bootstrap components, even if it seems to be working for you now. Source StackOverflow

Tagged ,