Telerik Forums
UI for WinForms Forum
3 answers
76 views

Hi,

 

I have been trying to override CellFormatting to reformat a string value to look like 2 labels, one above the other (in the same cell) e.g.:

Freddy Smith (standard font)

  On the phone (smaller font)

 

To do this I have been trying to create 2 RadHostControls, each one hosting a Label control and using .Location. .MaxSize etc properties to try to position the 2 labels (or their host controls) within the cell.

But somehow the first RadHostControl seems to take over all the spacein the cell (If I put the background to red I can see it occupies the whole cell).

Do you have any example where you have used multiple labels?

Many thanks.

 

(Using Q1 2016)

 

Dimitar
Telerik team
 answered on 08 Nov 2016
5 answers
165 views

Hello, I have a custom column, that is bound to a custom type, the custom type is a complex type, that have a (public string Display) property, that is the one I wish to use to filter the grid.

The excel like filter is working, maybe because the compex type have a "tostring" method, i attach a screenshot of the grid.

The standard filter is not working instead. All the filters are disabled. How can I make the filter cell to work with the complex type? I think i have to create a new filter cell descending from Telerik.WinControls.UI.GridFilterCellElement

then on my custom column:

public override Type GetCellType(GridViewRowInfo row)
       {
           if (row is GridViewDataRowInfo)
           {
               return typeof(LookupGridColumnElement);
           }
           else if (row is Telerik.WinControls.UI.GridViewFilteringRowInfo)
           {
               return typeof(LookupGridColumnFilterElement);
           }
                        
           return base.GetCellType(row);
       }

 

Is that the correct way? What do i need to override on my filter cell to let it work as if it were bound to a string field?

 

 

Dimitar
Telerik team
 answered on 08 Nov 2016
8 answers
1.1K+ views

I'm using Telerik.WinControls.GridView version 2012.2.912.40.

I validate a cell value in cell validating event.

I set e.Cancel = true in CellValidating event and then delete row of that cell with a command cell click event.

when the gridview's row count reach to zero and double click the gridview error occur "Exception thrown: 'System.NullReferenceException' in Telerik.WinControls.GridView.dll".

private void gvStockItemDetail_CellValidating(object sender, CellValidatingEventArgs e)
{

 if (!string.IsNullOrEmpty(Convert.ToString(e.Row.Cells["Stock ID"].Value)) && column.Name == "Quantity")
  {
    if (Convert.ToDecimal(string.IsNullOrEmpty(Convert.ToString(e.Value)) ? 0 : e.Value) <= 0)
     {
       e.Cancel = true;
       e.Row.Cells["Quantity"].BeginEdit();
       e.Row.ErrorText = BOL_Global_Message.STOCK.Msg_Quantity;                      
     }
    else
     {
       e.Row.ErrorText = string.Empty;
     }
   }

}

private void gvStockItemDetail_CommandCellClick(object sender, EventArgs e)
{
   if (gvStockItemDetail.CurrentRow.Index >= 0)
   {
    gvStockItemDetail.Rows.RemoveAt(gvStockItemDetail.CurrentRow.Index);

   }

}

Myo
Top achievements
Rank 1
 answered on 08 Nov 2016
1 answer
130 views

Collapsible Panels Controls Container is being focused on pressing ENTER key, however i have already set the following properties 

Focusable = false

TabStop = false

but focus is being transfer and tab is being stop 

can anybody guide what needs to be done here 

Regards

 

Dimitar
Telerik team
 answered on 08 Nov 2016
4 answers
133 views

Hi

How I can do to make the tab order do not appear in my radform radlabels? Please see the attached image.

Thanks

Angel

Angel
Top achievements
Rank 1
 answered on 07 Nov 2016
4 answers
1.0K+ views

Hello there,

I'm trying to implement a basic barcode scanner into my winforms application with radGridView. I'd like to search the GridView using this barcode scanner, so I have to fill the searchbox programatically. This is successful: I scan a code, it appears in the box. I have to use the Form's KeyPreview property set to TRUE and the Form's KeyPress event (because the scan ends as soon as the scanner send a NewLine character). Here's the code:

private string qrCode=string.Empty;

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    qrCode+=e.KeyChar;
    if (e.KeyChar == (char) Keys.Return)
    {
        StartSearch();
    }
}

private void StartSearch()
{
    GridViewSearchRowInfo searchRow = this.grdMyGridView.MasterView.TableSearchRow;
    searchRow.SearchProgressChanged += mySearchResult;
    searchRow.Search(qrCode);
    qrCode=string.Empty;
}

private void mySearchResult(object sender, SearchProgressChangedEventArgs e)
{
    Console.WriteLine("Results: " + e.Cells.Count);
}

 

My problem is, that I always get 0 results. The searchbox has the search string, this is no problem. If I type this string manually into this box, I get results perfectly. I want my GridView to show the results of scanned strings. Is this possible?

Thanks again for your help!

Attila

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Nov 2016
2 answers
213 views
I do not know how to do the following. I have in a form, layoutcontrol, which have several layoutControlItem with textbox. You can change the background color of the layoutcontrolitem (I want to be different from the color of the form).
Thank you
Oscar
Top achievements
Rank 1
 answered on 07 Nov 2016
1 answer
145 views
I am trying to set the text on Titlebar, but even after setting the text property in text primitive the text is not being appeared. I don't understand why it's been happening?
Dimitar
Telerik team
 answered on 07 Nov 2016
2 answers
388 views

I need to change the background color for input type controls (Textbox, etc...) when their property for ReadOnly is equal to True. Currently, it stays white and the font is bold. I'm new to VSB. I watched the videos and looked through the documentation, but I didn't see how to set the background color based on a control's ReadOnly property state. Is this possible? and if so, how is this done in VSB?

 

Thanks!

 

Gone2TheDogs
Top achievements
Rank 2
Iron
Veteran
 answered on 04 Nov 2016
3 answers
219 views

Hello!

 

I have a problem updating my sql db with my radGridView after successful binding. One of my sql column has 'bit' type, so the radGridView has a column with checkboxes. After I check/uncheck one of the checkboxes, it doesn't update my SQL unless I select another cell. Is there any solution to this problem? I use this event:

 

private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)        
{
             itemsTableAdapter.Update(telerikDataSet);
             ordersTableAdapter.Update(telerikDataSet);         
}

 

(I use table hierarchy. 'Orders' table is the parent, 'Items' table is the child. This is ok. I managed to solve that if I check the checkbox in the parent, all its child checkboxes will be checked too). This way:

 

private void radGridView1_ValueChanging(object sender, ValueChangingEventArgs e)         

{

            if (radGridView1.SelectedRows[0].Cells[3].ColumnInfo.HeaderText == "Closed")
           {
               if (radGridView1.SelectedRows[0].Cells["Closed"].IsCurrent)
               {
                   foreach (GridViewRowInfo item in radGridView1.SelectedRows)
                   {
                       GridViewHierarchyRowInfo hierarchyRow = item as GridViewHierarchyRowInfo;
                       if (hierarchyRow != null)
                       {
                           GridViewInfo currentView = hierarchyRow.ActiveView;
                           foreach (GridViewInfo view in hierarchyRow.Views)
                           {
                               hierarchyRow.ActiveView = view;
                               foreach (GridViewRowInfo row in hierarchyRow.ChildRows)
                               {
                                   radGridView1.ValueChanging -= radGridView1_ValueChanging;//without this getting infinite loop...
                                   row.Cells[4].Value = e.NewValue;
                                    ordersTableAdapter.Update(telerikDataSet);
                                    itemsTableAdapter.Update(telerikDataSet);
                                   radGridView1.ValueChanging += radGridView1_ValueChanging;
                               }
                           }
                           hierarchyRow.ActiveView = currentView;
                       }
                   }
               }
           }                    
}

Of course every other fields are working fine when I edit them: as soon as I hit enter, it updates SQL. But checkbox doesn't need enter...

Thanks for your help.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 04 Nov 2016
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?