Search This Blog

Showing posts with label Telerik. Show all posts
Showing posts with label Telerik. Show all posts

Tuesday, December 22, 2015

Clear filters RadGrid Telerik

Telerik > RadGrid > Clear filter

foreach (var column in RadGrid1.MasterTableView.Columns)
{
         column.CurrentFilterFunction = GridKnownFunction.NoFilter;
         column.CurrentFilterValue = string.Empty;
}

RadGrid1.MasterTableView.FilterExpression = string.Empty;
RadGrid1.MasterTableView.Rebind();





Monday, December 21, 2015

Print directly RadGridView

Telerik > Windows Forms > RadGridView > Print directly 


radGridView1.Print();







Thursday, October 1, 2015

Telerik report bind to DataTable and add a sample calculated field

Telerik > Reporting > Bind to DataTable

Example
Bind to DataTable and add a sample calculated field.

string connString = "Data Source=(local)\\SQLEXPRESS;Initial Catalog=HR;Integrated Security=True";
string cmdText = "SELECT FirstName, LastName FROM Person;";

SqlDataAdapter da = new SqlDataAdapter(cmdText, connString);
DataTable dt = new DataTable();
dataAdapter.Fill(dt);

Telerik.Reporting.ObjectDataSource ods = new Telerik.Reporting.ObjectDataSource();
ods.DataSource = dt;
ods.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("FullName", typeof(string), "=Fields.FirstName + ' ' + Fields. LastName ")); 
Telerik.Reporting.Report rpt = new Telerik.Reporting.Report();
rpt.DataSource = objectDataSource;
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = rpt;
reportViewer1.ReportSource = reportSource;
reportViewer1.RefreshReport();





Thursday, June 18, 2015

Remove border Telerik RadGridView

Telerik > RadGridView > Remove border

radGridView1.GridViewElement.DrawBorder = false;
radGridView1.GridViewElement.GroupPanelElement.DrawBorder = false;






Wednesday, April 1, 2015

Telerik GridViewCheckBoxColumn Alignment

Telerik > Windows Forms > RadGridView > GridViewCheckBoxColumn

GridViewCheckBoxColumn displays and allows editing of 

boolean data.

Example

GridViewCheckBoxColumn Alignment


<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsManager}" >
    <telerik:GridViewCheckBoxColumn.CellStyle>
        <Style TargetType="telerik:GridViewCell">
            <Setter Property="HorizontalContentAlignment" Value="Center" />
        </Style>
    </telerik:GridViewCheckBoxColumn.CellStyle>


</telerik:GridViewCheckBoxColumn>




Wednesday, November 19, 2014

Telerik RadTimePicker Get Selected Time

Telerik > RadTimePicker > Get Time


Get selected time from RadTimePicker c#.


DateTime dt = radTimePicker.SelectedDate.Value;
string time = dt.ToString("HH:mm:ss");






Friday, October 24, 2014

Telerik Reporting Binding C# Example

Telerik > Reporting > ObjectDataSource

ObjectDataSource component represents the middle-tier object and provides data retrieval capabilities. 
Example


var ods = new Telerik.Reporting.ObjectDataSource();
ods.DataSource = GetData();
ods.DataMember = "Products"; //table to bind to        
Telerik.Reporting.Report report = new Telerik.Reporting.Report();
report.DataSource = ods;
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = report;
reportViewer1.ReportSource = reportSource;
reportViewer1.RefreshReport();





Wednesday, September 24, 2014

Telerik RadGridView clear all rows

Telerik > RadGridView > Rows > Clear

Clear  is a efficient solution to remove all rows since the grid's events will be suspended.

Example
this.radGridView1.Rows.Clear();






Thursday, February 13, 2014

Add Image Column to Telerik Radgrid

Telerik > RadGridView > GridViewImageColumn

GridViewImageColumn displays read-only images for database columns of image data





GridViewImageColumn imageColumn = new GridViewImageColumn();
imageColumn.Name = "imgCol";
imageColumn.FieldName = "dbPhoto";
imageColumn.HeaderText = "Picture";
imageColumn.ImageLayout = ImageLayout.Zoom; // Zoom - Image is zoomed but the aspect ratio is preserved:
radGridView1.MasterTemplate.Columns.Insert(3, imageColumn);




Tuesday, January 21, 2014

RadGrid for ASP.NET AJAX

Telerik > RadGrid

RadGrid for ASP.NET AJAX is a control for data, paging, sorting, filtering and data editing to grouping and displaying hierarchical data.




RadPivotGrid ASP.NET example

Telerik > ASP.NET > RadPivotGrid

RadPivotGrid is a control used to aggregate records in a concise tabular format.

Example:

<telerik:RadPivotGrid ID="RadPivotGrid1" runat="server" DataSourceID="LinqDataSource1" AllowPaging="true" AllowFiltering="false" ShowFilterHeaderZone="false">
  <ClientSettings Scrolling-AllowVerticalScroll="true">
  </ClientSettings>
  <Fields>
         <telerik:PivotGridColumnField DataField="City">
     </telerik:PivotGridColumnField>
      <telerik:PivotGridColumnField DataField="Month">
      </telerik:PivotGridColumnField>
       <telerik:PivotGridRowField DataField="ProductName">
       </telerik:PivotGridRowField>
      <telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum">
    </telerik:PivotGridAggregateField>
    </Fields>
</telerik:RadPivotGrid>







Tuesday, November 12, 2013

GridBoundColumn RadGrid Telerik

Telerik > RadGrid > GridBoundColumn


GridBoundColumn is bound to a field in a data source.

Properties


Example:

GridBoundColumn staticColumn = new GridBoundColumn();
staticColumn = new GridBoundColumn();
staticColumn.DataField = "Title";
staticColumn.HeaderText = "Title";
grd.Columns.Add(staticColumn);




Friday, November 1, 2013

RadGridView for WinForms

Telerik > RadGridView

RadGridView Telerik  for Windows forms is a complex control that allows to display and edit tabular data from different  data sources.







    RadControls for WinForms

    Telerik > RadControls for WinForms

    Telerik RadControls for WinForms includes more than 60 controls that you can use to easily build visually appealing, high performance Line of Business and Metro applications.

    http://www.telerik.com/products/winforms.aspx

    Telerik

    Telerik is a software company making of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Automated Testing, Team Productivity and Run-time Analytics Tools.

    Reporting

    Windows Forms
    ASP.NET


    Friday, July 12, 2013

    Export RadGridView to Bitmap full Size

    Telerik > Windows Forms > Export RadGridView to Bitmap

    Sometimes is useful to export Telerik Rad Grid to image to its full size without regard of scroll bars.




    Example:

    Private Function GetImage(grd As Telerik.WinControls.UI.RadGridView)
            grd.Visible = False
            grd.Dock = DockStyle.None
            Dim w = 0
            For Each col In grd.Columns
                w = w + col.Width
            Next
            grd.Width = w
            If grd.Rows.Count > 0 Then
                grd.Height = (grd.Rows.Count * grd.Rows(0).Height)
            Else
                grd.Height = 150
            End If

            Dim bitmap As New Bitmap(grd.Bounds.Width, grd.Bounds.Height)
            grd.DrawToBitmap(bitmap, grd.Bounds)
            grd.Dock = DockStyle.Fill
            grd.Visible = True

            Return bitmap
    End Function




    Monday, June 3, 2013

    Disable Spin Editor GridViewDecimalColumn RadGridView

    Telerik > Windows Forms > > RadGridView > Disable Spin Editor


    GridSpinEditor represents a spin editor in RadGridView.

    Example: How to disable GridSpinEditor in RadGridView

      Private Sub RadGrid_CellEditorInitialized(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles Me.CellEditorInitialized
            Dim spinEditor As GridSpinEditor = TryCast(Me.ActiveEditor, GridSpinEditor)
            If spinEditor IsNot Nothing Then
                Dim element As GridSpinEditorElement = spinEditor.EditorElement
                element.ShowUpDownButtons = False
                element.InterceptArrowKeys = False
                element.EnableMouseWheel = False
            End If
        End Sub





    Thursday, April 4, 2013

    PlusMinus buttons visible RadTreeview Telerik

    Telerik > Windows Forms > PlusMinus buttons visible RadTreeview Telerik

    ExpanderElement: Gets the property grid item expander element.

    Example: PlusMinus buttons visible RadTreeview Telerik 

    Private Sub tv_NodeFormatting(sender As System.Object, e As Telerik.WinControls.UI.TreeNodeFormattingEventArgs) Handles tvArbore.NodeFormatting

    If e.Node.BackColor.Name <> "LightBlue" Then
         e.NodeElement.ExpanderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden
    Else
         e.NodeElement.ExpanderElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
    End If

    End Sub

     





    Thursday, March 14, 2013

    Set minimum and maximum value to GridViewDecimalColumn Telerik RadGridView


    Telerik > Windows Forms > RadGridView > GridViewDecimalColumn

    GridViewDecimalColumn allows decimal data to be displayed and edited and can be bound to fields of any numeric type.

    Examples:

    1. Add GridViewDecimalColumn in runtime

    GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn();
    decimalColumn.Name = "Price";
    decimalColumn.HeaderText = "Price";
    decimalColumn.FieldName = "Price";
    decimalColumn.DecimalPlaces = 2;
    radGridView1.MasterTemplate.Columns.Add(decimalColumn);

    2. Set minimum and maximum value to GridViewDecimalColumn Telerik RadGridView

    GridViewDecimalColumn decimalColumn = (GridViewDecimalColumn)this.radGridView1.Columns[0];
    decimalColumn.Minimum = 1;
    decimalColumn.Maximum = 100;




    How to limit the text length in RadGridView cell




    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
    if (e.ColumnIndex == 1)
    {
    if (e.Column is GridViewTextBoxColumn)
    {
    ((RadTextBoxEditorElement)((RadTextBoxEditor)this.radGridView1.ActiveEditor).EditorElement).MaxLength = 100;
    }
    }
    }