Geeks With Blogs

News

Locations of visitors to this page

View ► Sanjay Uttam [sanjay.uttam@gmail.com]'s profile on LinkedIn


Add to Google Reader or Homepage




Sanjay Uttam Predominantly .NET February 2010 Entries
Create IEnumerable<T> with one line in LINQ
Pretty straight-forward, but a useful snippet of code nonetheless. Given this class: public class AggregateContent { public string Title { get; set; } public string Description { get; set; } public AggregateContent(string Header, string Content) { Title = Header; Description = Content; } } You can use line to create an IEnumerable<AggregateCon... like this: IEnumerable<AggregateCon... a = LastNNewsItems.Select(p => new AggregateContent(p.NewsTitle, p.HtmlContent)); Technorati Tags: ......

Posted On Friday, February 5, 2010 4:45 PM

jQuery: Get value of checked checkboxes by name | className
Think this one speaks for itself :) //Get via name attribute. Would be better if you added form ID to selector var checkBoxes = $("input[name=" + checkBoxName + "]"); //Need to use each or you'll only get the first match $.each(checkBoxes, function() { if ($(this).attr('checked')){ //do stuff } }); //Get via class name. Would be better if you added form ID to selector var checkBoxes = $('.' + checkBoxClass); $.each(checkBoxes, function() { if ($(this).attr('checked')){ //do stuff } }); ......

Posted On Wednesday, February 3, 2010 11:50 AM

Copyright © Sanjay Uttam | Powered by: GeeksWithBlogs.net