S
shapper
Hello,
I am getting a question and its answers (options) for a poll and
inserting into the database.
When I display the form I would like the answers to appear at the same
order as they were inserted.
However, this is not happening ... In fact every time I create a poll,
even with same answers, it seems its options are saved in some random
order.
Here is my code:
Leaf.Options = Leaf.OptionsCSV.Split(
new char[] { ',' },
StringSplitOptions.RemoveEmptyEntries).Select(
o => new OptionLeaf {
Option = new Option {
OptionId = Guid.NewGuid(),
Answer = o.Trim(),
PollId = pollBook.Leaf.Poll.PollId,
}
}).ToList();
database.Options.InsertAllOnSubmit(Leaf.Options.Select(o =>
o.Option));
OptionsCSV is a string that contains the options inserted in an input.
For example:
Yes,No,Maybe
What is the best way to display the options using the same order as
they were inserted?
Thanks,
Miguel
I am getting a question and its answers (options) for a poll and
inserting into the database.
When I display the form I would like the answers to appear at the same
order as they were inserted.
However, this is not happening ... In fact every time I create a poll,
even with same answers, it seems its options are saved in some random
order.
Here is my code:
Leaf.Options = Leaf.OptionsCSV.Split(
new char[] { ',' },
StringSplitOptions.RemoveEmptyEntries).Select(
o => new OptionLeaf {
Option = new Option {
OptionId = Guid.NewGuid(),
Answer = o.Trim(),
PollId = pollBook.Leaf.Poll.PollId,
}
}).ToList();
database.Options.InsertAllOnSubmit(Leaf.Options.Select(o =>
o.Option));
OptionsCSV is a string that contains the options inserted in an input.
For example:
Yes,No,Maybe
What is the best way to display the options using the same order as
they were inserted?
Thanks,
Miguel