Click here to Skip to main content
15,890,438 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: slideshow Pin
Richard MacCutchan29-Sep-13 21:33
mveRichard MacCutchan29-Sep-13 21:33 
AnswerRe: slideshow Pin
Abhinav S30-Sep-13 18:37
Abhinav S30-Sep-13 18:37 
QuestionSelect data on the basis of URL. Pin
webmas128-Sep-13 1:11
professionalwebmas128-Sep-13 1:11 
AnswerRe: Select data on the basis of URL. Pin
Richard MacCutchan29-Sep-13 21:31
mveRichard MacCutchan29-Sep-13 21:31 
AnswerRe: Select data on the basis of URL. Pin
David Mujica30-Sep-13 2:13
David Mujica30-Sep-13 2:13 
AnswerRe: Select data on the basis of URL. Pin
Govindaraj Rangaraj30-Sep-13 23:29
Govindaraj Rangaraj30-Sep-13 23:29 
QuestionHow to Handle Null using LINQ during Datatable CrossJoin C# Pin
priyaahh27-Sep-13 0:51
priyaahh27-Sep-13 0:51 
AnswerRe: How to Handle Null using LINQ during Datatable CrossJoin C# Pin
Richard Deeming27-Sep-13 2:04
mveRichard Deeming27-Sep-13 2:04 
priyaahh wrote:
If any of the table is not having row, then I am getting no records in my resultant cartesian product table.

The Cartesian product of any set with the empty set is the empty set. That's fairly basic set theory.

You'll need a custom extension method which will return a single empty row if the table is empty:
C#
public static class DataTableExtensions
{
    public static IEnumerable<DataRow> AsEnumerableNotEmpty(this DataTable table)
    {
        if (table == null) throw new ArgumentNullException("table");
        if (table.Rows.Count != 0) return table.Rows.Cast<DataRow>();
        return new[] { table.NewRow() };
    }
}


You'll then need to change your LINQ query to call the custom method:
C#
var newDatatable = from TowerName in dtTower.AsEnumerableNotEmpty()
                   from CountryName in dtCountry.AsEnumerableNotEmpty()
                   from Level in dtLevel.AsEnumerableNotEmpty()
                   from CityName in dtCity.AsEnumerableNotEmpty()
                   from BandName in dtBand.AsEnumerableNotEmpty()
                   from EType in dtEmploymentType.AsEnumerableNotEmpty()
                   from Skill in dtSkill.AsEnumerableNotEmpty()
                   select new { TowerName, CountryName, Level, CityName, BandName, EType, Skill };




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How to Handle Null using LINQ during Datatable CrossJoin C# Pin
priyaahh29-Sep-13 21:10
priyaahh29-Sep-13 21:10 
QuestionHardware ID in ASP.NET Shared Hosting environment Pin
devvvy25-Sep-13 15:14
devvvy25-Sep-13 15:14 
AnswerRe: Hardware ID in ASP.NET Shared Hosting environment Pin
Bernhard Hiller25-Sep-13 21:31
Bernhard Hiller25-Sep-13 21:31 
GeneralRe: Hardware ID in ASP.NET Shared Hosting environment Pin
devvvy25-Sep-13 23:39
devvvy25-Sep-13 23:39 
QuestionChange Image format with fixed size on image upload Pin
SAM_India25-Sep-13 11:35
SAM_India25-Sep-13 11:35 
AnswerRe: Change Image format with fixed size on image upload Pin
Bernhard Hiller25-Sep-13 21:38
Bernhard Hiller25-Sep-13 21:38 
QuestionImage Viewer in asp.net C# Pin
Member 1029206123-Sep-13 4:07
Member 1029206123-Sep-13 4:07 
AnswerRe: Image Viewer in asp.net C# Pin
Abhinav S23-Sep-13 20:34
Abhinav S23-Sep-13 20:34 
GeneralRe: Image Viewer in asp.net C# Pin
Member 1029206123-Sep-13 21:15
Member 1029206123-Sep-13 21:15 
AnswerRe: Image Viewer in asp.net C# Pin
Abhinav S23-Sep-13 21:18
Abhinav S23-Sep-13 21:18 
GeneralRe: Image Viewer in asp.net C# Pin
Member 1029206123-Sep-13 21:21
Member 1029206123-Sep-13 21:21 
QuestionAfter Binding 1000+ Records In Gridview Other Events Not Firing Pin
Arunkumar.23-Sep-13 1:59
Arunkumar.23-Sep-13 1:59 
AnswerRe: After Binding 1000+ Records In Gridview Other Events Not Firing Pin
Richard MacCutchan23-Sep-13 2:58
mveRichard MacCutchan23-Sep-13 2:58 
GeneralRe: After Binding 1000+ Records In Gridview Other Events Not Firing Pin
Arunkumar.23-Sep-13 20:07
Arunkumar.23-Sep-13 20:07 
QuestionRe: After Binding 1000+ Records In Gridview Other Events Not Firing Pin
Richard MacCutchan23-Sep-13 20:32
mveRichard MacCutchan23-Sep-13 20:32 
AnswerRe: After Binding 1000+ Records In Gridview Other Events Not Firing Pin
Arunkumar.23-Sep-13 20:41
Arunkumar.23-Sep-13 20:41 
Questioni have a web site with some sub domain for rewriting i use this code in web confic: Pin
Uthman Rahimi22-Sep-13 10:48
professionalUthman Rahimi22-Sep-13 10:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.