Thursday, April 25, 2013

Get column name from radgrid of telerik in an array

function GetColumnNames()
        {
         var grid = $find("<%=RadGrid1.ClientID %>"); 
         var columnCount = grid.get_masterTableView().get_columns().length;
         var Colname=new Array();
         for(var i=0;i<columnCount;i++)
         {
         var UniqueName=grid.get_masterTableView().get_columns()[i].get_uniqueName();
         Colname[i]=UniqueName;
         }
        }

textbox key press by jQuery

Jquery
$(document).ready(function(){
var keypress_count1 = 0;
$("#txt_onkeypress").keypress(function(){
    keypress_count1++;   
  document.getElementById("<%=Label1.ClientID %>").innerHTML=document.getElementById("name_onkeypress").value;
});
});

HTML
<input type="text" id="txt_onkeypress" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


Wednesday, April 10, 2013

Html Exporting Radgrid

The purpose of this event is to allow the developer to insert global styles (CSS) or configuration options (XML) to the exported file. A possible application for this event is to enable the grid lines for the current worksheet:

protected void Radgrid1_HTMLExporting(object sender, GridHTMLExportingEventArgs e)
    {
        e.Styles.Append("body { border:solid 0.1pt #CCCCCC; }");
    }

For More Information

http://www.telerik.com/help/aspnet-ajax/grid-html-export.html

Friday, April 5, 2013

Wednesday, April 3, 2013

Get QueryString By Javascript

    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);       
        var vars = query.split("&");
                
        for (var i=0;i<vars.length;i++)
        {  
            var pair = vars[i].split("=");                                       
            if (pair[0] == variable)
            {
                return pair[1];
            }
        }
    }


to get

var Str = getQueryVariable("QueryStringName");

Wednesday, March 20, 2013

Clear radgrid selected row by client side

 var masterTable = $find("<%=Radgrid1.ClientID%>").get_masterTableView();
    masterTable.clearSelectedItems();

Monday, March 11, 2013

Merge cell in radgrid

protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
                      for (int rowIndex =  RadGrid1.Items.Count - 2; rowIndex >= 0; rowIndex--)
        {
            GridDataItem row =  RadGrid1.Items[rowIndex];
            GridDataItem previousRow =  RadGrid1.Items[rowIndex + 1];

            for (int cellIndex = 0; cellIndex < row.Cells.Count; cellIndex++)
            {
                if (row.Cells[cellIndex].Text == previousRow.Cells[cellIndex].Text)
                {
                    row.Cells[cellIndex].RowSpan = previousRow.Cells[cellIndex].RowSpan < 2 ? 2 :              previousRow.Cells[cellIndex].RowSpan + 1;
                    previousRow.Cells[cellIndex].Visible = false;
                }
            }
        }
    }