How to display the data of type List<List<int>> on page?
What way can you recommend? Perhaps, there is some control for this purpose.
I'm trying to generate input data for learning neural network for recognation black-white images. I have the table 3x3, clicking on cells the background color is changed. Black means "1", white - "0". And for selected combination it's need to set the output value.
开发者_Python百科So, in that case I receive 0,0,1,1,0,0,0,0,1 and output - 1 This List I generate using Javascript and send to codebehind by means of hidden field.
I must show these combinations on page with the ability to delete them
Sounds like a couple controls might be in order. Normally if I have a list of lists, I'd use 2 list/combo boxes in a master-detail relationship.
What is the actual scenario you're working with? How are users expecting to work with the data? What does it represent?
Edit: In response to the additional information about what you're using this for:
I suggest whipping up a server/usercontrol. I'd probably go with a table (yes I know, I said the naughty word) with a little javascript to flip colors. You could either detect the colors or maintain some manner of hidden field for persisting the values as you are already doing now. Expose the "answers" as public properties on the control.
Note the save button would also be part of this control. I'm not sure about the checkbox since that's a bool derived from certain combinations of answers, if I'm reading that correctly. That would probably become just another bool method on your control. In that method, it could check the current state of the grid and decide whether it should return true or false. If the user really can tick that checkbox themselves, then simply include it as part of the control.
List<List<int>> someList;
foreach(List<int> list in someList)
{
foreach(int i in list){
// Display here
Response.Write(i);
}
}
<ul>
<% foreach (List<int> ints in list) { %>
<li><%= string.Join(", ",ints) %></li>
<% } %>
</ul>
精彩评论