Generate dropdown fields in gridview with options as values in columns with the same ID in another column












0















I''m having trouble generating dropdown fields in which T_IDs with similar ID are grouped and put inside the dropdowns as options- forming a list of dropdown fields inside a gridview. This is written in c# .net (webforms) with sql server.



I illustrated below the output I'm expecting. If someone could help me with this it'd be appreciated. Thanks!



db table:



 ID |   T_ID   | Name
----+----------+------
1 | 98 | Joe
1 | 34 | Joe
1 | 56 | Joe
1 | 12 | Joe
2 | 67 | Mary
2 | 12 | Mary
3 | 87 | Penn
3 | 23 | Penn
3 | 61 | Penn


expected output:



(ID 1)
Joe | 98 | -dropdown
| 34 |
| 56 |
| 12 |
| 22 |

(ID 2)
Mary| 67 |
| 12 |

(ID 3)
Penn| 87|
| 23|
| 61|


or



dropdowns










share|improve this question

























  • I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

    – Zohar Peled
    Nov 22 '18 at 7:00











  • @ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

    – troubledsoul
    Nov 22 '18 at 7:05













  • Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

    – Zohar Peled
    Nov 22 '18 at 7:09











  • I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

    – troubledsoul
    Nov 22 '18 at 7:23













  • Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

    – Zohar Peled
    Nov 22 '18 at 8:43
















0















I''m having trouble generating dropdown fields in which T_IDs with similar ID are grouped and put inside the dropdowns as options- forming a list of dropdown fields inside a gridview. This is written in c# .net (webforms) with sql server.



I illustrated below the output I'm expecting. If someone could help me with this it'd be appreciated. Thanks!



db table:



 ID |   T_ID   | Name
----+----------+------
1 | 98 | Joe
1 | 34 | Joe
1 | 56 | Joe
1 | 12 | Joe
2 | 67 | Mary
2 | 12 | Mary
3 | 87 | Penn
3 | 23 | Penn
3 | 61 | Penn


expected output:



(ID 1)
Joe | 98 | -dropdown
| 34 |
| 56 |
| 12 |
| 22 |

(ID 2)
Mary| 67 |
| 12 |

(ID 3)
Penn| 87|
| 23|
| 61|


or



dropdowns










share|improve this question

























  • I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

    – Zohar Peled
    Nov 22 '18 at 7:00











  • @ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

    – troubledsoul
    Nov 22 '18 at 7:05













  • Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

    – Zohar Peled
    Nov 22 '18 at 7:09











  • I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

    – troubledsoul
    Nov 22 '18 at 7:23













  • Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

    – Zohar Peled
    Nov 22 '18 at 8:43














0












0








0








I''m having trouble generating dropdown fields in which T_IDs with similar ID are grouped and put inside the dropdowns as options- forming a list of dropdown fields inside a gridview. This is written in c# .net (webforms) with sql server.



I illustrated below the output I'm expecting. If someone could help me with this it'd be appreciated. Thanks!



db table:



 ID |   T_ID   | Name
----+----------+------
1 | 98 | Joe
1 | 34 | Joe
1 | 56 | Joe
1 | 12 | Joe
2 | 67 | Mary
2 | 12 | Mary
3 | 87 | Penn
3 | 23 | Penn
3 | 61 | Penn


expected output:



(ID 1)
Joe | 98 | -dropdown
| 34 |
| 56 |
| 12 |
| 22 |

(ID 2)
Mary| 67 |
| 12 |

(ID 3)
Penn| 87|
| 23|
| 61|


or



dropdowns










share|improve this question
















I''m having trouble generating dropdown fields in which T_IDs with similar ID are grouped and put inside the dropdowns as options- forming a list of dropdown fields inside a gridview. This is written in c# .net (webforms) with sql server.



I illustrated below the output I'm expecting. If someone could help me with this it'd be appreciated. Thanks!



db table:



 ID |   T_ID   | Name
----+----------+------
1 | 98 | Joe
1 | 34 | Joe
1 | 56 | Joe
1 | 12 | Joe
2 | 67 | Mary
2 | 12 | Mary
3 | 87 | Penn
3 | 23 | Penn
3 | 61 | Penn


expected output:



(ID 1)
Joe | 98 | -dropdown
| 34 |
| 56 |
| 12 |
| 22 |

(ID 2)
Mary| 67 |
| 12 |

(ID 3)
Penn| 87|
| 23|
| 61|


or



dropdowns







sql .net tsql gridview dropdown






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 7:29







troubledsoul

















asked Nov 22 '18 at 6:21









troubledsoultroubledsoul

127




127













  • I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

    – Zohar Peled
    Nov 22 '18 at 7:00











  • @ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

    – troubledsoul
    Nov 22 '18 at 7:05













  • Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

    – Zohar Peled
    Nov 22 '18 at 7:09











  • I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

    – troubledsoul
    Nov 22 '18 at 7:23













  • Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

    – Zohar Peled
    Nov 22 '18 at 8:43



















  • I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

    – Zohar Peled
    Nov 22 '18 at 7:00











  • @ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

    – troubledsoul
    Nov 22 '18 at 7:05













  • Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

    – Zohar Peled
    Nov 22 '18 at 7:09











  • I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

    – troubledsoul
    Nov 22 '18 at 7:23













  • Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

    – Zohar Peled
    Nov 22 '18 at 8:43

















I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

– Zohar Peled
Nov 22 '18 at 7:00





I'm not sure I understand the question. The expected output is a gridview where names are in one column, and the second column is a dropdown with all T_ID's related to the name? What exactly are you having problems with?

– Zohar Peled
Nov 22 '18 at 7:00













@ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

– troubledsoul
Nov 22 '18 at 7:05







@ZoharPeled I apologize if my question is somewhat confusing, I'm having difficulty writing this in English. I want to generate dropdown fields which options are the values in the column T_ID grouped by ID which is the Name's ID. See the 'expected output' part of the question, those are my illustration of the dropdowns I'm hoping to generate.

– troubledsoul
Nov 22 '18 at 7:05















Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

– Zohar Peled
Nov 22 '18 at 7:09





Already seen the expected output, I'm asking if this is a label column and a dropdown column. Also, as it is now, your question is too broad. You should narrow the scope of your question to the particular part of the task that you can't solve on your own. You don't expect us to provide a fully functional sql + c# solution, right? One more thing - you should specify the UI framework you are working with - asp.net? wpf? winforms? some other UI framework?

– Zohar Peled
Nov 22 '18 at 7:09













I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

– troubledsoul
Nov 22 '18 at 7:23







I updated the question.. I have actually generated the output but I don't think the way I made it is ideal. It's too long and slow, since I have over 30k items in the table.

– troubledsoul
Nov 22 '18 at 7:23















Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

– Zohar Peled
Nov 22 '18 at 8:43





Depending on the grid's capabilities, this might be solved by selecting all records from the table, and just filtering the values in the dropdown when it's being opened. I'm not sure that's the best approach but it is possible.

– Zohar Peled
Nov 22 '18 at 8:43












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424953%2fgenerate-dropdown-fields-in-gridview-with-options-as-values-in-columns-with-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424953%2fgenerate-dropdown-fields-in-gridview-with-options-as-values-in-columns-with-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]