Bir Linq sorgusu sonucundan SelectListItem array'i nasıl elde edilir?

April 29, 2009 at 2:34 PMoozturk

Merhaba,

Mesela 10 kolonlu bir sorgu sonucu var ve SelectListItem oluşturmak isteniliyor ki DropDownList gibi listelerde kullanabilsin, nasıl yapmalı?

( from bs in DenemeRepository.GetDeneme()
                                             select new SelectListItem
                                             {
                                                 Value = bs.DenemeID.ToString(),
                                                 Text = bs.DenemeName,
                                                 Selected = false
                                             } );

Yukarıdaki kodu duruma göre modifiye ederek elde edilebilir.

İyi günler!

Posted in: MVC

Tags:

Comments (8) -

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Reply

I am glad I found your site on facebook. Thank you for the sensible critique. Me and my brother were just preparing to do some research about this. I am glad to see such trusted information being shared freely out there.
Regards,
Anantha from Garden Grove city

Reply

Zero Nicotine is an innovative cessation aid designed to help you give up smoking safely and naturally, WITHOUT PUTTING MORE NICOTINE INTO YOUR BODY. If you are serious about your decision to quit, you’ve come to the right place! With its unique blend of ingredients, Zero Nicotine offers you the best possible chance to finally kick the habit for good!

Reply

Fantastic site! Your writing is so fresh in comparison to most other writers. Thank you for posting when you do, I'll be sure to keep visiting!

Reply

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.

Reply

vlfkefxykrc <a href=http://casinoonlinecasinoonline.org>online casino bonus</a> jgowpqu

Reply

Have you thought about adding some videos to your article? I think it will really enhance viewers' understanding.

Reply

This blog site is very cool. How was it made !?

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading