Telerik Forums
UI for WinForms Forum
3 answers
195 views
Hi Julian,

as requested, here is the code for setting up my Master and Child and populating, unbound data (please let me know if you need more info)

I Really need to be able to access the RowIndex Value

thanks

Regards

Steve

       void CreateUnboundHierarchy()  
        { 
  
                this.radGridView.MasterTemplate.Reset(); 
                SetupMasterForUnbound();
                GridViewTemplate ChildTemplate = SetupChildForUnbound();
  
                this.radGridView.Templates.Add(ChildTemplate);
                this.radGridView.CreateCell += new GridViewCreateCellEventHandler(radGridView_CreateCell); 
  
  
  
                //--
                ChildTemplate.HierarchyDataProvider = new GridViewEventDataProvider(ChildTemplate);
                //this.radGridView.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(radGridView_RowSourceNeeded);
                this.radGridView.UserAddingRow += new GridViewRowCancelEventHandler(radGridView_UserAddingRow);
                LoadDataForUnbound();
        }
        void SetupMasterForUnbound() 
        {
            this.radGridView.AllowAutoSizeColumns = true; 
            this.radGridView.MasterTemplate.AllowAddNewRow = false;
            this.radGridView.MasterTemplate.AllowDeleteRow = false;
            //-------------
            //--
            GridViewCheckBoxColumn chk1 = new GridViewCheckBoxColumn("SO");
            chk1.HeaderText = "SO";
            chk1.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(chk1);
            //-------------
            //--
            GridViewTextBoxColumn textColumn1 = new GridViewTextBoxColumn("ChargeCode");
            textColumn1.HeaderText = "ChargeCode";
            textColumn1.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(textColumn1);
            //--
            GridViewTextBoxColumn textColumn2 = new GridViewTextBoxColumn("Description");
            textColumn2.HeaderText = "Description";
            textColumn2.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(textColumn2); 
            //--
            GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("UnitCost");
            decimalColumn.HeaderText = "UnitCost";
            decimalColumn.FormatString = "{0:0.000}";
            decimalColumn.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(decimalColumn);
            //--
            GridViewDecimalColumn decimalColumn1 = new GridViewDecimalColumn("Qty");
            decimalColumn1.HeaderText = "Qty";
            decimalColumn1.FormatString = "{0:0.000}";
            decimalColumn1.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(decimalColumn1);
            //--
            GridViewDecimalColumn decimalColumn3 = new GridViewDecimalColumn("TotalCost");
            decimalColumn3.HeaderText = "TotalCost";
            decimalColumn3.FormatString = "{0:0.000}";
            decimalColumn3.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(decimalColumn3);
            //--
            //--
            GridViewCheckBoxColumn chk2 = new GridViewCheckBoxColumn("Charge");
            chk2.HeaderText = "Charge";
            chk2.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(chk2);
            //--
            GridViewCheckBoxColumn chk3 = new GridViewCheckBoxColumn("Checked");
            chk3.HeaderText = "Checked";
            chk3.ReadOnly = true;
            this.radGridView.MasterTemplate.Columns.Add(chk3);
            //--
            this.radGridView.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            //----------------------------
  
  
        }
        private GridViewTemplate SetupChildForUnbound()
        {
            GridViewTemplate template = new GridViewTemplate(); 
            template.AllowAddNewRow = true;
            template.AllowDeleteRow = false;
            //---------------------------------------------------------------
            //---------------------------------------------------------------
            GridViewTextBoxColumn editButtonColumn = new GridViewTextBoxColumn();
            editButtonColumn.Name = "Edit";
            editButtonColumn.FieldName = "Edit";
            editButtonColumn.ReadOnly = true;
            editButtonColumn.HeaderText = "Edit";
            editButtonColumn.Width = 100;
            template.Columns.Add(editButtonColumn); 
            //-----------------------------------------------------------------
//            template.Columns.Add(new GridViewCheckBoxColumn("SO"));
            GridViewDecimalColumn Num = new GridViewDecimalColumn("Billable");
            Num.HeaderText = "Billable";
            Num.ReadOnly = true;
            Num.IsVisible = false;
            template.Columns.Add(Num);
            //--
            GridViewCheckBoxColumn chk1 = new GridViewCheckBoxColumn("SO");
            chk1.HeaderText = "SO";
            chk1.ReadOnly = true;
            template.Columns.Add(chk1);         
            //--
            GridViewTextBoxColumn textColumn1 = new GridViewTextBoxColumn("ChargeCode");
            textColumn1.HeaderText = "ChargeCode";
            textColumn1.ReadOnly = true;
            template.Columns.Add(textColumn1);
            //--
            GridViewTextBoxColumn textColumn2 = new GridViewTextBoxColumn("Description");
            textColumn2.HeaderText = "Description";
            textColumn2.ReadOnly = true;
            template.Columns.Add(textColumn2);
            //--
            GridViewTextBoxColumn textColumn3 = new GridViewTextBoxColumn("Barcode");
            textColumn3.HeaderText = "Barcode";
            textColumn3.ReadOnly = true;
            template.Columns.Add(textColumn3);
            //--
            GridViewTextBoxColumn textColumn4 = new GridViewTextBoxColumn("Dept");
            textColumn4.HeaderText = "Dept";
            textColumn4.ReadOnly = true;
            template.Columns.Add(textColumn4);
            //--
            GridViewDateTimeColumn Date1 = new GridViewDateTimeColumn("Date");
            Date1.HeaderText = "Date";
            Date1.ReadOnly = true;
            Date1.FormatString = "{0:d}";
            template.Columns.Add(Date1);
            //--            
            GridViewTextBoxColumn textColumn5 = new GridViewTextBoxColumn("Site");
            textColumn5.HeaderText = "Site";
            textColumn5.ReadOnly = true;
            template.Columns.Add(textColumn5);
            //--
            GridViewDecimalColumn decimalColumn1 = new GridViewDecimalColumn("Qty");
            decimalColumn1.HeaderText = "Qty";
            decimalColumn1.FormatString = "{0:0.000}";
            decimalColumn1.ReadOnly = true;
            template.Columns.Add(decimalColumn1);
            //--
            GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("UnitCost");
            decimalColumn.HeaderText = "UnitCost";
            decimalColumn.FormatString = "{0:0.000}";
            decimalColumn.ReadOnly = true;
            template.Columns.Add(decimalColumn);
            //--
            GridViewDecimalColumn decimalColumn3 = new GridViewDecimalColumn("TotalCost");
            decimalColumn3.HeaderText = "TotalCost";
            decimalColumn3.ReadOnly = true;
            decimalColumn3.FormatString = "{0:0.000}";
            template.Columns.Add(decimalColumn3);
            //--
            GridViewCheckBoxColumn chk2 = new GridViewCheckBoxColumn("Charge");
            chk2.HeaderText = "Charge";
            chk2.ReadOnly = true;
            template.Columns.Add(chk2);
            //--
            GridViewCheckBoxColumn chk3 = new GridViewCheckBoxColumn("Checked");
            chk3.HeaderText = "Checked";
            chk3.ReadOnly = true;
            template.Columns.Add(chk3);
            //--
            template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            return template;
        }
        void LoadDataForUnbound() 
        {
            using (this.radGridView.DeferRefresh())
            {
                for (int i = 0; i < dts_DWBillDataSet.sps_BillableGrouped.Count; i++)
                {
                    dts_DWBillDataSet.sps_BillableGroupedRow row = dts_DWBillDataSet.sps_BillableGrouped[i];
                    this.radGridView.MasterTemplate.Rows.Add(row.SO, row.ChargeCode, row.Description, row.UnitCost, row.Qty, row.TotalCost,row.Charge,row.Checked);
                }
            }
        }
Stephen Breytenbach
Top achievements
Rank 1
 answered on 09 May 2011
13 answers
559 views
Is there a way to make the Rad controls look like normal WinForms controls? I making a business app and don't need the facy styles, but it needs to take on whatever style Windows XP is using, or no styles. One of the problems is that the Telerik styles don't render well in low resolutions, i.e. remoting.
Nikolay
Telerik team
 answered on 09 May 2011
1 answer
93 views
In this version, it looks like when a node goes into edit mode, you are editing the value, rather than the text.  I have a tree bound to a binding list, where the value is an ID, and the display text is a string value.  When the node is edited, the value ID appears, and is the field that is edited.  How can I edit the text, rather than the value?  This worked properly in 2010 Q1, which is the last version I used.  Thanks!
Stefan
Telerik team
 answered on 09 May 2011
1 answer
187 views
Hi,
Im using telerik RadComboBox. It is populated it using a datatable. While populating i set both the text and value fields. Later I'm trying to find whether a record is available using the value(not text). pls let me know how.
Code for populating:
cmbState.DataSource = stateTable;
cmbState.DisplayMember = "state_name";
cmbState.ValueMember = "state_code";

code for retrieving:
if (cmbState.FindItem(dr["OWNER_STATE_CODE"].ToString().Trim() ) != null)
{
    index = cmbState.FindItem(dr["OWNER_STATE_CODE"].ToString().Trim() ).Index;
    cmbState.SelectedIndex = index;
}

here im checking based on the displaymember property. But i want to check based on the value member property.
Stefan
Telerik team
 answered on 09 May 2011
1 answer
194 views
When a row in my grid isn't valid, this little exclamation point shows up in the far left hand column. The problem is it overlaps whatever image is already there (like the pencil when editing a row)  which makes it hard to tell what it's supposed to be. Is there a way to fix this?
Svett
Telerik team
 answered on 09 May 2011
2 answers
161 views
Hi,

After I upgrade from Q3 2010 to Q1 2011, I found that the "AllowAddNewRow" property does not work in GridView.
In the previous version, I set the "AllowAddNewRow" property to false, so there is no "Click to add a new row" row display in the grid.
However, after I upgrade to Q1 2011, the "Click to add a new row" row still display in the gridview even I set the "AllowAddNewRow" to false.
What can I do?

Best Regards,
Emily
Stefan
Telerik team
 answered on 09 May 2011
7 answers
460 views
is there a way to get the X,Y coordinates of  Gridview CommandCellClick event?
I am trying to show a panel when clicked on the button and want to postion the new panel right below the command button clicked on the gridview.

Thanks in advance for any help.
Arc
Richard Slade
Top achievements
Rank 2
 answered on 09 May 2011
3 answers
257 views
Hi:
I need Customize the text for the controls in the RadGridView Custom Dialog.

Thanks.
Richard Slade
Top achievements
Rank 2
 answered on 09 May 2011
3 answers
186 views
Hi:
I need highlight the filter simbol when a filter is applied on this column

thanks.
Richard Slade
Top achievements
Rank 2
 answered on 09 May 2011
1 answer
164 views
Hi, i tried to follow this KB "how to add a checkbox header" to add a checkbox to the header of a checkboxcolumn of grid view
but when ever i try to scroll till the Column(which contains the Check box in its header) disappears behind the grid NullRefrenceException Happens in this method
 public override void Detach()
        {
            base.Detach();
            this.GridControl.ValueChanged -= GridControl_ValueChanged;
        }

im using the latest version

thank you
Richard Slade
Top achievements
Rank 2
 answered on 09 May 2011
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)
Form
Chart (obsolete as of Q1 2013)
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
PdfViewer and PdfViewerNavigator
CommandBar
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
Label
AutoCompleteBox
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
SmartPasteButton
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?