Telerik Forums
UI for WinForms Forum
5 answers
539 views

Hi,

 

I'm unable to mimic Master - Detail data display using RadGridView control. Let me know where I'm going wrong.

Following is my code:

private void BindGrid()
        {
            try
            {
                DataTable dtDept = new DataTable();
                DataColumn dcDptID = new DataColumn("DeptID");
                DataColumn dcDName = new DataColumn("DeptName");
                dtDept.Columns.Add(dcDptID);
                dtDept.Columns.Add(dcDName);

                DataRow drDPT = dtDept.NewRow();
                drDPT["DeptID"] = "10";
                drDPT["DeptName"] = "Admin";
                dtDept.Rows.Add(drDPT);

                drDPT = dtDept.NewRow();
                drDPT["DeptID"] = "11";
                drDPT["DeptName"] = "Finance";
                dtDept.Rows.Add(drDPT);
                
                DataTable dtEmp = new DataTable();
                DataColumn dcID = new DataColumn("EmpID");
                DataColumn dcName = new DataColumn("EmpName");
                DataColumn dcDeptID = new DataColumn("DeptID");
                dtEmp.Columns.Add(dcID);
                dtEmp.Columns.Add(dcName);
                dtEmp.Columns.Add(dcDeptID);

                DataRow dRow = dtEmp.NewRow();
                dRow["EmpID"] = "1001";
                dRow["EmpName"] = "Raaz";
                dRow["DeptID"] = "10";
                dtEmp.Rows.Add(dRow);

                dRow = dtEmp.NewRow();
                dRow["EmpID"] = "1002";
                dRow["EmpName"] = "Amit";
                dRow["DeptID"] = "11";
                dtEmp.Rows.Add(dRow);

                rdGridDemo.MasterTemplate.DataSource = dtDept ;

                GridViewTemplate gvChildTemplate = new GridViewTemplate();
                gvChildTemplate.AutoGenerateColumns = false;
                gvChildTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
                gvChildTemplate.AllowAddNewRow = false;
                gvChildTemplate.EnableCustomGrouping = false;
                gvChildTemplate.EnableGrouping = false;
                gvChildTemplate.ShowGroupedColumns = false;

                GridViewTextBoxColumn colEmpID = new GridViewTextBoxColumn();
                colEmpID.Name = "colEmpID";
                colEmpID.HeaderText = "Employee ID";
                colEmpID.FieldName = "EmpID";
                gvChildTemplate.Columns.Add(colEmpID);

                GridViewTextBoxColumn colEmpName = new GridViewTextBoxColumn();
                colEmpName.HeaderText = "Employee Name";
                colEmpName.FieldName = "EmpName";
                gvChildTemplate.Columns.Add(colEmpName);

                GridViewTextBoxColumn colDeptID = new GridViewTextBoxColumn();
                colDeptID.HeaderText = "Dept ID";
                colDeptID.FieldName = "Dept ID";
                gvChildTemplate.Columns.Add(colDeptID);

                gvChildTemplate.DataSource = dtEmp;

                rdGridDemo.Templates.Clear();
                rdGridDemo.Relations.Clear();
                rdGridDemo.MasterTemplate.Templates.Add(gvChildTemplate);
                
                GridViewRelation relation = new GridViewRelation(rdGridDemo.MasterTemplate);
                relation.ChildTemplate = gvChildTemplate;
                relation.RelationName = "EmpDeptRelation";
                relation.ParentColumnNames.Add("DeptID");
                relation.ChildColumnNames.Add("DeptID");
                rdGridDemo.Relations.Add(relation);
                
            }
            catch (Exception Ex)
            {
                lblMsg.Text = Ex.Message;
            }
        }

 

/* Thanks */

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 16 Aug 2017
1 answer
142 views
I have a radRichTextEditor in a small space so there is no room for a RichTextEditorRibbonBar. Instead I'm putting all of the formatting options I need on the context menu. I've added a "Bullets" menu item to the context menu and got this working to add bullets to the selected text. However I'd like this to work in a Toggle fashion so that if the selected text already has bullets, it removes them. If the selected text doesn't have text, it adds them. How do I work out if the selected text has bullets or not?
Dimitar
Telerik team
 answered on 16 Aug 2017
8 answers
900 views
Hey Everyone,

I am having an issue regarding the GridViewSynchronizationService trying to reference an object that has been disposed. Here is what I am doing ... I have a form with a grid on it. The user double clicks an entry in the grid, then the id column from the grid is stored into a variable and then passed as a reference to a form that is being opened. As soon as the form opens, the requesting form disposes itself. Upon disposing I receive the following error: Cannot access a disposed object. Object name: 'GridViewSynchronizationService'.

I will attach the code so that you can see what is happening. I have found the only way to avoid this from happening is to add a timer object to the form and have it dispose the form after waiting about 3 seconds, however this simply doesn't feel right.
using System;
using System.Linq;
using System.Windows.Forms;
using PlantManager.Classes;
 
namespace PlantManager.Admin.UserManager
{
    public partial class frmUserManager : Form
    {
        public frmUserManager()
        {
            InitializeComponent();
        }
 
        private void frmUserManager_Load(object sender, EventArgs e)
        {
            LoadData();
        }
 
        private void LoadData()
        {
            QueryAgent qry = new QueryAgent();
            qry.SQLText = "SELECT tbl_Users.UserID,tbl_Users.Username,tbl_Users.FirstName,tbl_Users.LastName,tbl_Users.PhoneExt,tbl_Users.EmailAddress FROM dbo.tbl_Users WHERE tbl_Users.Active = 1";
            qry.exec_SelectQuery();
            dgResults.DataSource = qry.DataSource;
        }
 
        private void mnuEditUser_Click(object sender, EventArgs e)
        {
            EditUser();
        }
 
        private void dgResults_DoubleClick(object sender, EventArgs e)
        {
            EditUser();
        }
 
        private void EditUser()
        {
            string UserID = dgResults.CurrentRow.Cells["UserID"].Value.ToString();
            PubVar.OpenForm("Admin.UserManager.frmEditUser", new string[1] { UserID }, this, true);
            this.Dispose();
        }
    }
}

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 16 Aug 2017
6 answers
2.9K+ views

How do I get the index of a ListView item when the user right clicks on it?

Note: I do not want to set the SelectedItem of the ListView and get SelectedIndex. 

Thank you,

Mohammad

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 16 Aug 2017
2 answers
146 views

Hello,

How can I remove the border around the quick access buttons. This border appears with the Telerik Metro theme. Interestingly, when the Quick Access buttons are placed below the ribbon the border does not appear. 

Thanks,

 

Robert

Robert
Top achievements
Rank 1
Iron
 answered on 15 Aug 2017
2 answers
476 views
In C#, how can I show the Details text of the RadMessageBox control without requiring user to click the Details button (to drop down the details). Thank you.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 14 Aug 2017
1 answer
71 views

I'm test out the Scheduler.  I'm trying to cancel moving a appointment if it new date is past todays date.  In the AppointmnetDropped, i figured i should check and cancel here. I cannot find a cancel function to set.  I did find in other posts you used a  "e.Cancel = true"  e is AppointmentMovingEventArgs.  But can not see a Cancel in the AppointmentMovingEventArgs. 

Did this way change?  

I'm using VB.net 2015. 

Lawrence

 

 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 14 Aug 2017
2 answers
124 views

I'm using version 2017.2.613.40 of RadDock.

I'm using RadDock to host custom user controls by calling:

radDock.DockControl(_HostedControl, DefaultDockPosition, DockType.Document);

 

This creates a HostWindow.  It works great, however some of my user controls have somewhat expensive paint events.  For example, one is a chart which could have tens of thousands of data points and it can take a second or two to repaint the control.  Obviously, I'd like for this paint to be instant, but it's not.  It's what I'm stuck with for now.

My issue is when I try to rearrange DockWindows by dragging them to a different position in the RadDock and docking them there.  The dragging triggers repaints in the user control.  And the user control tries to repaint while it's being dragged.  This ends up stalling everything for a couple seconds several times during the drag.  This makes it not just annoying, but almost impossible to move DockWindows around which is one of the main reasons, of course, to use a RadDock in the first place.

My question is this:  what are the best RadDock or DockWindow events to subscribe to in order to disable my control when the drag starts and then to re-enable it after it gets re-docked at a new location in the RadDock.

Since these are custom controls, I have the ability to turn off painting or hide the control completely, I just need the right hooks to be able to do this at the right times.

Thanks,

Steve

 

Steve
Top achievements
Rank 1
 answered on 11 Aug 2017
3 answers
193 views

Hi,

I want to use WinForms RadDigram as platform for a gui Editor.
is it possible to add a "normal" control object like button or even an RadChart as RadDiagramShape ?

 

BTW: ist WinForms a right choys for future prooft Projects

 

Besdt Regards
Paul

Hristo
Telerik team
 answered on 11 Aug 2017
3 answers
374 views

Hello,

I just started to figure out how to use the Telerik 2016.3.1024.40 components with OpenEdge 11.7.1.

Using the RadGridView and BindingSource components I am unable to show the records of one of the tables in my database.

I connected the BindingSource to the table (for example "SomeTable") of my choice and set the RadGridView.DataSource property to the BindingSource. During design-time I see the correct fields of the table, but no records. With the PropertyBuilder the order of the columns can be changed which is also visible in the grid. So far so good.

When I run the application an empty record is shown and when I try to add a new record or edit the contents of the empty record, the message "BindingSource is not bound to a DataSource" is shown.

Do I miss some code to load the records in the grid?

 

When I connect the grid to another BindingSource that is not connected to a table in my database, the following code can be used to display the contents of the table (just to demonstrate that the grid is able to display at least something):

        DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
        DEFINE VARIABLE hdsSomeTable AS HANDLE NO-UNDO.
        DEFINE DATASET dsSomeTable FOR ttSomeTable.
        FOR EACH SomeTable NO-LOCK:
            CREATE ttSomeTable.
            BUFFER-COPY SomeTable TO ttSomeTable.
        END.
        hdsSomeTable = DATASET dsSomeTable:HANDLE.
        hQuery = hdsSomeTable:TOP-NAV-QUERY.
        hQuery:QUERY-OPEN().
        bindingSource1:HANDLE = hQuery.

Please advise,

Bert

 

Hristo
Telerik team
 answered on 10 Aug 2017
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
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
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
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?