Telerik Forums
UI for WinForms Forum
12 answers
784 views
I saw an example on how to replace the default RadGridView context (right-click) menu with a "user"-defined context menu. But how do I add items to the default menu.

VB .NET code only, please.

Finn
Nikolay
Telerik team
 answered on 23 Jul 2009
1 answer
135 views
Hi,
   I have a radgridview with the theme set to vista. It seems this and the default theme has column gridlines but no row ones.

How can I enable this at design time?

To give an idea of what i mean think excel sheet.
Thanks.
Boryana
Telerik team
 answered on 23 Jul 2009
7 answers
363 views
Hello,
how can I display my own combobox values in an unbound RadGridView when editing? The values are not specific to any columns or rows, in my scenario each cell can have completely different combobox values to offer (some can be even edited as free text or as numeric value).

Thanks in advance for your support
ZS
Jack
Telerik team
 answered on 23 Jul 2009
3 answers
235 views

Hi,

I am trying out the GridView in a programmatically manner, to build a hierarchy of an exception tree.  I don’t know if my approach is the best way, please tell if otherwise. The hierarchy is shown, but there are two issues I can’t figure out.

First, Due to the relationship all rows are shown as expandable! Only the root exception row and the InnerException row should be expandable. I have tried setting the ParentID to zero for those rows that are not expandable, but then they are not shown at all?

Second, In the expanded (nested) grid two tabs appear (named; table1 and table2), how do I remove/hide those?

Cheers, Frank

---------------------------- Sample Code -------------------------

  public class ExceptionExplorer
  {
    private static readonly string FIELD_EXCEPTIONID = "ExceptionID";
    private static readonly string FIELD_PARENTID = "ParentID";
    private static readonly string FIELD_NAME = "Name";
    private static readonly string FIELD_VALUE = "Value";

    public void ShowData(RadGridView gridView)
    {
      gridView.AutoGenerateHierarchy = false;
      gridView.AllowDrop = false;
      gridView.ShowGroupPanel = false;
      gridView.ShowNoDataText = false;
      
      try
      {
        gridView.Enabled = false;
        gridView.GridElement.BeginUpdate();
        gridView.Rows.Clear();

        List<Exception> exceptions = new List<Exception>();
        exceptions.Add(new ArithmeticException("ArithmeticException", new DataMisalignedException("DataMisalignedException", new global::System.NotSupportedException("NotSupportedException", new NotImplementedException("NotImplementedException")))));
        exceptions.Add(new ArgumentOutOfRangeException("ArgumentOutOfRangeException", new NullReferenceException("NullReferenceException", new global::System.NotSupportedException("NotSupportedException", new NotImplementedException("NotImplementedException")))));

        PrepareGridViewTemplate(gridView.MasterGridViewTemplate);
        int exceptionID = 0;
        foreach (Exception exception in exceptions)
        {
          ShowException(gridView.MasterGridViewTemplate, null, ref exceptionID, 0, exception.GetType().Name, exception);
        }
      }
      finally
      {
        gridView.GridElement.EndUpdate();
        gridView.Enabled = true;
      }
    }

    private void ShowException(GridViewTemplate gridviewTemplate, GridViewDataRowInfo parentRow, ref int exceptionID, int parentID, string exceptionTitle, Exception exception)
    {
      GridViewDataRowInfo exceptionRow = CreateGridRow(gridviewTemplate, parentRow, ++exceptionID, parentID, exceptionTitle, exception.GetType().FullName);

      parentID = exceptionID;
      GridViewTemplate childGridViewTemplate = CreateChildGridViewTemplate(gridviewTemplate);

      CreateGridRow(childGridViewTemplate, exceptionRow, ++exceptionID, parentID, "Message", exception.Message);
      CreateGridRow(childGridViewTemplate, exceptionRow, ++exceptionID, parentID, "Source", exception.Source);
      CreateGridRow(childGridViewTemplate, exceptionRow, ++exceptionID, parentID, "HelpLink", exception.HelpLink ?? string.Empty);
      CreateGridRow(childGridViewTemplate, exceptionRow, ++exceptionID, parentID, "TargetSite", exception.TargetSite == null ? string.Empty : exception.TargetSite.ToString());
      CreateGridRow(childGridViewTemplate, exceptionRow, ++exceptionID, parentID, "Stacktrace", exception.StackTrace);

      if (exception.InnerException != null)
      {
        ShowException(childGridViewTemplate, exceptionRow, ref exceptionID, parentID, "InnerException", exception.InnerException);
      }
    }

    private GridViewDataRowInfo CreateGridRow(GridViewTemplate gridviewTemplate, GridViewDataRowInfo parentRow, int exceptionID, int parentID, string nameColumn, string valueColumn)
    {
      //      GridViewDataRowInfo dataRow = gridviewTemplate.Rows.AddNew(/*parentRow*/); // Gives NullReferenceException...
      //      GridViewDataRowInfo dataRow = gridviewTemplate.Rows.AddNew();
      //      dataRow.Cells[FIELD_EXCEPTIONID].Value = exceptionID.ToString();
      //      dataRow.Cells[FIELD_PARENTID].Value = parentID.ToString();
      //      dataRow.Cells[FIELD_NAME].Value = nameColumn;
      //      dataRow.Cells[FIELD_VALUE].Value = valueColumn;
      // Gives NullReferenceException if cells are addressed through index/name ???

      GridViewDataRowInfo dataRow = gridviewTemplate.Rows[gridviewTemplate.Rows.Add(exceptionID, parentID, nameColumn, valueColumn)];
      dataRow.EnsureVisible();

      return dataRow;
    }

    private void PrepareGridViewTemplate(GridViewTemplate gridviewTemplate)
    {
      gridviewTemplate.AutoGenerateColumns = false;

      GridViewDataColumn gridColumn;
      gridviewTemplate.Columns.Add(gridColumn = new GridViewDataColumn(FIELD_EXCEPTIONID));
      gridColumn.IsVisible = false;
      SetColumnDefaults(gridColumn);

      gridviewTemplate.Columns.Add(gridColumn = new GridViewDataColumn(FIELD_PARENTID));
      gridColumn.IsVisible = false;
      SetColumnDefaults(gridColumn);

      gridviewTemplate.Columns.Add(gridColumn = new GridViewDataColumn(FIELD_NAME));
      gridColumn.Width = 200;
      SetColumnDefaults(gridColumn);

      gridviewTemplate.Columns.Add(gridColumn = new GridViewDataColumn(FIELD_VALUE));
      gridColumn.MinWidth = 200;
      SetColumnDefaults(gridColumn);

      gridviewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

      gridviewTemplate.AllowAddNewRow = false;
      gridviewTemplate.AllowDeleteRow = false;
      gridviewTemplate.AllowEditRow = false;
      gridviewTemplate.AllowColumnChooser = false;
      gridviewTemplate.AllowColumnReorder = false;
      gridviewTemplate.AllowDragToGroup = false;

      gridviewTemplate.ShowColumnHeaders = gridviewTemplate.Owner.MasterGridViewTemplate == gridviewTemplate;
      gridviewTemplate.ShowFilteringRow = false;
      gridviewTemplate.ShowGroupedColumns = false;
    }

    private GridViewTemplate CreateChildGridViewTemplate(GridViewTemplate parentTemplate)
    {
      GridViewTemplate childTemplate = new GridViewTemplate(parentTemplate.Owner);
      PrepareGridViewTemplate(childTemplate);

      GridViewRelation relation = new GridViewRelation(parentTemplate);
      relation.ChildTemplate = childTemplate;
      relation.RelationName = "ExceptionRelation";
      relation.ParentColumnNames.Add(FIELD_EXCEPTIONID);
      relation.ChildColumnNames.Add(FIELD_PARENTID);
      parentTemplate.Owner.Relations.Add(relation);

      parentTemplate.ChildGridViewTemplates.Add(childTemplate);

      return childTemplate;
    }

    private void SetColumnDefaults(GridViewDataColumn gridColumn)
    {
      gridColumn.HeaderText = gridColumn.FieldName;
      gridColumn.AllowFiltering = false;
      gridColumn.AllowGroup = false;
      gridColumn.AllowSort = false;
    }
  }

Jack
Telerik team
 answered on 23 Jul 2009
1 answer
201 views

Requirements

 

.Net Framework

3.5

Visual Studio version

2008 

Programming Language

C#


PROJECT DESCRIPTION
Only an example of using Linq to SQL with the Datagrid control

 

DataClasses1DataContext db = new DataClasses1DataContext();

 

 

var query = from p in db.Mst_Reconcilations

 

 

where p.Pat_Last_Name.StartsWith("A") && p.Pat_First_Name.StartsWith("C")

 

 

select new CustomerOrderResult

 

{

ID = p.ID,

AccNo = p.Acc_No,

CharNo = p.Chg_No,

FName = p.Pat_First_Name,

LName = p.Pat_Last_Name,

DOS = p.DOS

};

dataGridView1.DataSource = query;

dataGridView1.Columns[0].Visible =

false;

 

Vassil Petev
Telerik team
 answered on 23 Jul 2009
7 answers
159 views
What is the best way to prevent editing of primary key column(s) in the data grid?  I do not want the user to edit existing primary key column(s), however, I do want them to be able to edit the primary key column(s) when adding a new row.

Thanks for your help in advance,

James
Jack
Telerik team
 answered on 23 Jul 2009
3 answers
99 views
Hello,
  I am new to Telerik winforms controls. I have a RadGridView consisting of  a GridViewComboBoxColumn. I want to display images
within the combo-box, and when a selection is made, I want the selection text box of the combo-box to also display the image, not
just the text associated with it.

Also, I want to be able to implement the DblClick on the combo-box so that the images will rotate through the list
of images.

Can I accomplish this using a GridViewComboBoxColumn, or do I have to add a custom element to the grid cells?
I have been combing through the examples and forums, but have not been successful in implementing this functionality.

Thanks in advance,

Adriana

Victor
Telerik team
 answered on 23 Jul 2009
3 answers
116 views
Hi,

In a thread I working through our very slow Database (No its not SQL) and fill the Data in a DataTable. When a new row gets added to that DataTable I want to add the new row to the RadGrid as well. I thought iIwould increase the Rows.Count poperty and read the Row Info out of the DataTable in the Controls CellValuenNeeded event. The problem is that I get always an unhandlet exception sonner or later. When i remove the Event, the Datatable gets loaded correctly in the background.

Am I doing something wrong or do I use the wrong approach? Even locking has not helped me out.

Hope you can help me here.

Thanks
Victor
Telerik team
 answered on 23 Jul 2009
3 answers
142 views
I am new to Telerik and have a basic question. Does the Winform Listbox have the same feature set as the ASP Listbox? I am looking for item reordering and the ability to transfer from one listbox to another. Thanks...
Boyko Markov
Telerik team
 answered on 23 Jul 2009
1 answer
192 views
Hi,

Dont we have transition effect in rad rotator control.

I want something like transition.

Please find few effects from given link

http://tataindicom.com/

and

http://www.longtailvideo.com/players/jw-image-rotator/

I understand that web pages can achieve these using javascript or SWF files.
It will be great if same is available in winform applications.

Thanks & Best Regards,
Divyesh Chapaneri
Nick
Telerik team
 answered on 22 Jul 2009
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Barcode
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Licensing
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?