Click here to Skip to main content
14,690,956 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'l explain u my concept..
I have a dropdownlist and a dynamic table...
when i select in dropdownlist i want data to be changed in dynamic table according to the selected value in dropdown... and also how to link database to the table....
CRDave1988 18-Feb-12 7:47am
What u have try till now? where u get problem?

On the SelectionIndexChanged(), Fire The Query For That particular item and fill your dynamic table.

This is the simple way to do that.

But i haven't understood your other question about linking database to table. What you exactly want here?
Navya_21 19-Feb-12 3:18am
Sorry i'm very new to c#....
in SelectionIndexChanged() i hve given the query bt hw wil it display in that dynamic table.... I'l tel u wht i'm trying is in dropdown i have 2 option of assign and not assign... when i select assign i should get only the people who r nt assigned in that table which is stored in database, likewise when i select not assign i should get only that list.... can u pls explain me how to do this since i'm very new to dis....
Aniket Yadav 19-Feb-12 5:07am
can you tell me the database fields of the table you are using?
And also the table that you have linked with your dropdown box.
So that i can figure it out for you
Navya_21 21-Feb-12 1:46am
The dropdownlist i have added static data, it contains assign and not assign two items.... In database table the fields are Shift_details_Id, Shift_ID,Emp_ID,From_time, To_time,Assigned_date,Status....
All these fields contains the related info and the status field contain info as Assign or Not Assign... When i select Not Assign in dropdownlist i Should get all fields mentioned above whose status in Not Assign, like wise when i select Assign i should get only dat.... can u pls tel me neatly how to do dis....
private void cmbDropDownBox_SelectionIndexChanged()
    string myStr = "";
    if(cmbDropDownBox.SelectedIndex != -1)
        if(cmbDropDownBox.Text == "Assigned")
            //Fire The Query For Status = "Assigned"
            myStr = "SELECT * FROM YourTableName WHERE Status = '" + cmbDropDownBox.Text + "'";
            //Store The Data Into the Datatable
            //And From the Datatable, display it into your grid
        else if(cmbDropDownBox.Text == "Not Assigned")
            //Fire The Query For Status = "Not Assigned"
            myStr = "SELECT * FROM YourTableName WHERE Status = '" + cmbDropDownBox.Text + "'";
            //Store The Data Into the Datatable
            //And From the Datatable, display it into your grid

Hope You Will Get An Idea Through This...
Navya_21 21-Feb-12 10:20am
Thank u soo much, dis is ok bt the point where i'm stuck is after storing it 2 datatable i want 2 display it in dynamic table not in grid, so pls if u have an idea tel me...
Aniket Yadav 21-Feb-12 23:41pm
What is Your dynamic table? It is same as datatable created dynamically. Am i right? If i am right then fetch the data from the query to your dynamic table instead of datatable...
Navya_21 23-Feb-12 8:27am
Dynamic table in the sense ### table which is been added.....
can u tel me code to display in that table after storing in datatable....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900