Telerik Forums
UI for WinForms Forum
6 answers
134 views
I have a situation where I'd like to provide the user with some common values to select for a column in a GridView, based on the value of another column that exists in the row. I know this can be done with the AutoComplete mode on the column. The problem is that I'd also like to allow them to add a new value that doesn't appear in the list if they want. Is there a way to allow the user to enter a custom value with the GridViewMultiComboBoxColumn or am I going about this all wrong?

Any pointers in the right direction would be greatly appreciated. Thanks!
Dimitar
Telerik team
 answered on 24 Mar 2014
3 answers
184 views
Hello,
I am trying to figure out the INotifyPropertyChangd interface for using a Binding list with a grid. I CRUD my data to the database with code and display in the grid but I have to call a method to load the data into the grid every time I make a change. I am missing something to bind my data to the grid whenever a change is made. I created some small demo files and have looked at multiple examples but am still having problems figuring the link between the db and the grid. Below is what I have created to help understand the concept. One thing to note is that I am creating my data table using ORM fluent mapping in code.

​ //public class _Student
public class _Student : System.ComponentModel.INotifyPropertyChanged
{
private int id;
private string name;
private string grade;

public int Id
{
get { return id; }
set
{
id = value;
this.OnPropertyChanged("Id");
}
}

public string Name
{
get { return name; }
set
{
name = value;
this.OnPropertyChanged("Name");
}
}

public string Grade
{
get { return grade; }
set
{
grade = value;
this.OnPropertyChanged("Grade");
}
}

private void OnPropertyChanged(string PropertyName)
{
this.OnPropertyChanged(new PropertyChangedEventArgs(PropertyName));
}

protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
if (PropertyChanged != null)
{
PropertyChanged(this, args);
}
}

public event PropertyChangedEventHandler PropertyChanged;


//Mapping.
internal static MappingConfiguration<_Student> StudentMapping()
{
var config = new MappingConfiguration<_Student>();
config.MapType(x => new
{
Name = x.Name,
Grade = x.Grade,
}).ToTable("Student");
config.HasProperty(p => p.Id).IsIdentity(KeyGenerator.Autoinc);
config.HasProperty(p => p.Name).IsNotNullable().IsUnicode().HasLength(50);
config.HasProperty(p => p.Grade).IsNullable().IsUnicode().HasLength(50);
return config;
}
}

public class _vmstudent
{
//INSERT.
public static void InsertNewStudentInfo(BindingList<_Student> stud)
{
using (ProjectSpecSqlFluentContext db = new ProjectSpecSqlFluentContext())
{
foreach (var item in stud)
{
if (!db._Students.Any(x => x.Name.Equals(item.Name)))
{
_Student s = new _Student
{
Name = item.Name,
Grade = item.Grade
};
db.Add(s);
}
}
db.SaveChanges();
}
}

//UPDATE.
public static void UpdateStudentInfo(int Id, string BestGrade)
{
using (ProjectSpecSqlFluentContext db = new ProjectSpecSqlFluentContext())
{
if (db._Students.Any(x => x.Id.Equals(Id)))
{
_Student s = db._Students.Single(x => x.Id.Equals(Id));
s.Grade = BestGrade;
db.SaveChanges();
}
}
}

//READ.
public static BindingList<_Student> ReadStudentInfo()
{
BindingList<_Student> list;
using (ProjectSpecSqlFluentContext db = new ProjectSpecSqlFluentContext())
{
var result = (from s in db._Students
select new _Student
{
Id = s.Id,
Name = s.Name,
Grade = s.Grade
}).ToList();
list = new BindingList<_Student>(result);
}
return list;
}

//DELETE.
public static void DeleteStudentInfo(int Id)
{
using (ProjectSpecSqlFluentContext db = new ProjectSpecSqlFluentContext())
{
if (db._Students.Any(x => x.Id.Equals(Id)))
{
_Student s = db._Students.FirstOrDefault(x => x.Id.Equals(Id));
db.Delete(s);
db.SaveChanges();
}
}
}
}


public partial class StudentForm : Telerik.WinControls.UI.RadForm
{
private BindingList<_Student> student;

public StudentForm()
{
InitializeComponent();

////Default schema.
//vmSchema.AddDefaultTableInfo();

this.radGridView1.DataSource = _vmstudent.ReadStudentInfo();

this.rbtnAdd.Click += rbtnAdd_Click;
this.rbtnDelete.Click += rbtnDelete_Click;
this.rbtnBestGrade.Click += rbtnBestGrade_Click;
}

//ADD...
void rbtnAdd_Click(object sender, EventArgs e)
{
student = new BindingList<_Student>();
student.Add(new _Student { Id = 0, Name = "Peter", Grade = "A" });
student.Add(new _Student { Id = 0, Name = "John", Grade = "B" });
student.Add(new _Student { Id = 0, Name = "Tony", Grade = "C" });
student.Add(new _Student { Id = 0, Name = "David", Grade = "D" });

_vmstudent.InsertNewStudentInfo(student);
this.radGridView1.DataSource = _vmstudent.ReadStudentInfo();
}


//BEST GRADE...
void rbtnBestGrade_Click(object sender, EventArgs e)
{
int index = this.radGridView1.Rows.IndexOf(radGridView1.CurrentRow);
string id = this.radGridView1.Rows[index].Cells["Id"].Value.ToString();

_vmstudent.UpdateStudentInfo(Convert.ToInt16(id), txtBestGrade.Text);
this.radGridView1.DataSource = _vmstudent.ReadStudentInfo();
}

//DELETE..
void rbtnDelete_Click(object sender, EventArgs e)
{
int index = this.radGridView1.Rows.IndexOf(radGridView1.CurrentRow);
string id = this.radGridView1.Rows[index].Cells["Id"].Value.ToString();

_vmstudent.DeleteStudentInfo(Convert.ToInt16(id));
this.radGridView1.DataSource = _vmstudent.ReadStudentInfo();
}
}

Your help would be appreciated.

Thanks

Gavin



George
Telerik team
 answered on 24 Mar 2014
3 answers
260 views
I have a winform app that is using Telerik RadGridView. It has several GridViewTemplate and in 1 of the GridViewTemplate I want to have self reference relation, so my question is
- can I cast GridViewTemplate to RadGridView so I use
         RadGridView.Relations.AddSelfReference
- or can have some way that I can use directly
         GridViewTemplate.Relations.AddSelfReference

Thanks.
Tom
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Mar 2014
2 answers
110 views
VB.Net in VS2010.
I have a scheduler that's in a RadForm that is an MDI child inside a RadDock on the parent form, which is also a RadForm. The mouse wheel does not work in the scheduler. If I put a scheduler on a non MDI form the mouse wheel does work. Do you have any suggestions as to where I can look for the problem? It has been like this since the 2012 version of Telerik Controls and I just updated to 2014.1.226.40 hoping the problem would be solved.
Dimitar
Telerik team
 answered on 21 Mar 2014
3 answers
136 views
Can I put the custom control (treeview with checkbox) inside the GridViewTemplate. I have the .Net winform, which is using the Rad GridView, display the customer information, when user click on that customer, the sub templates will open (3 tabs), I coded for 2 tabs which display detail information. I want to code the last tab display the treeview with checkbox in it and user can select checkbox to turn on or off the options they want to use.
Thanks.
Ivan Petrov
Telerik team
 answered on 21 Mar 2014
2 answers
140 views
How can I turn off the selected record arrow in the MultiColumn ComboBox.  I am using a custom theme.

Thanks.
Paul
Top achievements
Rank 1
 answered on 21 Mar 2014
1 answer
170 views
Hi,
In my quick review of controls encounter a problem with export to PDF from your RichTextBox. When i type something in cyrilic and then save as PDF file the result is quite strane. I mean many random spaces and generally weird layout. You can easy reproduce this in the winforms demo application. So, is it some kind of bug or there is a way to change this behavior in the code?
Best Regards,
Slavcho
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Mar 2014
4 answers
160 views
I'm working on developing our own theme, based on the WPF windows 8 theme. I have an issue with contextual ribbon bars. My guess is that these can't be themed in the Visual Builder. However, I can't work out how to theme them in code either.

This is what we currently have


What I would like to do is 
1 - Theme the ribbontabbutton; the background colour, border and text. I can change the unselected background colour of the tab, but this only has an affect until the first time the ribbon is selected. Once switching away, the colour reverts to white. I also can't work out how to change the selected colour at all, which is what I really want to do

2 - Remove the colouring on the main panel area that contains the groups etc. I just want it to be white.

3 - Would be nice to change the unselected colour of the contextual ribbontabbutton as well (want it a shade of the orange, but that's not so important

Any help would be greatly appreciated.

Thanks
Jason
George
Telerik team
 answered on 20 Mar 2014
1 answer
122 views
I recently started using visual style builder and I must say I love it.  Definitely a little learning curve but very reasonable given its impressive capabilities.  I was able to get my custom theme working in my application with little trouble.  However, I can't get it working on a non-dev computer at all.  I have deployed multiple applications using your awesome suite, both web and windows, never having any difficulty.  I set all telerik dependencies to copy local and copy the full release folder to the target computer.  When I run the .exe, I get either nothing at all or maybe eventually the error saying "this application has stopped working".  I even tried copying the theme .xml files to the target machine but still no joy.  I have searched and come up empty so here I am.  Please let me know if I can provide any screenshots, assemblies, etc to make my issue clearer.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Mar 2014
1 answer
127 views
http://www.telerik.com/help/winforms/gridview-grouping-group-aggregates.html

GroupDescriptor descriptor = new GroupDescriptor();
descriptor.GroupNames.Add("ShipName", ListSortDirection.Ascending);
descriptor.Aggregates.Add("Count(ShipName)");
descriptor.Aggregates.Add("Max(Freight)");
descriptor.Aggregates.Add("Avg(Freight)");
descriptor.Format = "The ship {1} has {2} item(s) with maximum freight {3} and avarage freight of {4:c2} per ship.";
this.radGridView1.GroupDescriptors.Add(descriptor);

How to do sort by Max (descriptor.Aggregates.Add("Max(Freight)");)
How to do ability to let Antonio Moreno Taqueria(max 84.84) is first ,Alfreds Futterkiste (max 69.53) is second ,Ana Trujillo Emparedados y helados (max 43.9) is third.
George
Telerik team
 answered on 20 Mar 2014
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?