473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate DataGridComboBo x dynamically as per value in first column

Hi,

I need urgent help on Windows Form datagrid. I have to Display a datagrid
that has a textbox column and another one combo box column. I have two tables
in my Access database as:
Table 1:
Columns: Part_ID, Descr
Here Part_ID is Primary key.

Table 2:
Columns: Part_ID, Part_Functions
Here Part_ID refers to column of table above.

Now I need to enter "Descr" value in first textbox column and as per the
corresponding "Part_ID", I need to populate the ComboBox with
"Part_Functions " in second column.

i.e. the Values populated in ComboBox should be correspond to the Part_ID
for that row only. The purpose behind this is that user enters a Description
of Part in first column, from which we can get "Part_MID". Now for second
column, the dropdown should be populated only with values that map to that
Part_MID in Table 2.

This is Windows Form DataGrid not Web Based Datagrid.

Please help me to solve this out.
Will appreciate a quick help,

TIA
SA.

Sep 28 '05 #1
1 2729
Digit
4 New Member
Check this site :
http://msdn.microsoft.com/msdnmag/is...ds/?print=true

The only thing that bothers me with this option is that u sort what is in the data and not what u c :(
What I mean is when you have 2 codes in your rows :
Code 1 : representing "ZZZ"
Code 2 : representing "AAA"
Then u 'll c in the column "ZZZ" and "AAA" but when u sort this column he will put "ZZZ" before "AAA" because he'll sort the codes behind the representations (1 and 2).
Have no sollution for this except creating an extra column which actually contains strings (or ints,....) and show this column.

Once you create the comboboxcolumn class, you can use it something like this :
DataGridComboBo xColumn MyComboColumnSt yle;
MyComboColumnSt yle = new TestComboColumn ();
MyComboColumnSt yle.HeaderText= "Type";
MyComboColumnSt yle.MappingName ="TypeVerrichti ng";
MyComboColumnSt yle.ComboBox.Da taSource=dtHist Types;
MyComboColumnSt yle.ComboBox.Di splayMember="Om schrijvingTaal1 ";
MyComboColumnSt yle.ComboBox.Va lueMember="Code ";
MyDataGridTable StyleProductHis tory.GridColumn Styles.Add(MyCo mboColumnStyle) ;
dataGridProduct History.Preferr edRowHeight=MyC omboColumnStyle .ComboBox.Heigh t+1;

Don't mind the strange names in it like "OmschrijvingTa al1", I'm dutch and I don't want to change all the names :D

Hope this helps :)
Sep 28 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2906
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
11
17638
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer s(i)=new string(test) Above line gives - error implicit conversion string to 1-dim array of
0
320
by: Swadh | last post by:
Hi, I need urgent help on Windows Form datagrid. I have to Display a datagrid that has a textbox column and another one combo box column. I have two tables in my Access database as: Table 1: Columns: Part_ID, Descr Here Part_ID is Primary key. Table 2:
4
5047
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup, websites, MSDN and was not able to find something that would help me understand and code. I might not be searching for the right words or phrases. So if you know how to do this or know of links or websites that have information about this, please...
1
6501
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to java class which creates a xml file based on values entered in dynamic jsp page. Now i want to read all those values entered to xml in my other jsp page. I am able to call values from file in my jsp page. But as dynamic values can be any in no...
0
4045
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to java class which creates a xml file based on values entered in dynamic jsp page. Now i want to read all those values entered to xml in my other jsp page.But as dynamic values can be any in no i don't know how could i populate all those in my jsp...
1
5994
by: freekedoutfish | last post by:
Hi. New member here Im sat at work, pounding my head off the desk because this tiny bit of simple code refuses to work. The sub is intended to pull data from the "companyname" column in the "cmSelectAllCompanyNames" table, and put all the company names it finds into the "cbFilterCompanyName" combo box. Now the confusing aspect is this: It works!!!
3
4358
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If condition1 is true, then the SqlDataReader will be populated with the records existing in table1 & will return 0 to the calling function but if condition2 is true, then the SqlDataReader will be populated with the records from another table named...
1
3875
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with the works. My problem is that i want to send 2 columns to the gridview instead of 1, but i cant figure out how to add the second column to the gridview. <asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server" ShowHeader="false">...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.