Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Elmar
0
11
0
User Control - DataGridView with combobox columns
May 6 2013 9:46 AM
Trying to build a simple User Control to populate dataGridView with a Table data. Scenario - Table1: RegionID, Region, ManagerID; Table2: PersonID, Name. I'd like to display Region and Name in the grid where the 2nd column is a combobox with all names from Table 2 and also each cell in the col 2 has value based on ManagerID = PersonID. The code is working fine when it's a win app without user control.
dGrRegions.DataSource = ds.Tables[0]; (ds Dataset SELECT RegionID, Region, ManagerID FROM Table1)
dGrRegions.Columns[0].Visible = false;
dGrRegions.Columns[2].Visible = false;
var column = new DataGridViewComboBoxColumn();
column.DataPropertyName = "PersonID";
column.DataSource = dsPeople.Tables[0]; (Dataset SELECT PersonID, Name...)
column.ValueMember = "PersonID";
column.DisplayMember = "Name";
column.HeaderText = "Manager";
dGrRegions.Columns.Add(column);
but when I create a control and pass all needed info as parameters all works fine except that the col 2 doesn't show current values - it's blank but combobox has all dropdown values
Any idea?
Reply
Answers (
0
)
Find User Control Inside Repeater Control On Button Click
How to call onRowCommand event from custom control page