Posts

Showing posts from October, 2012

Donate

Object doesn't support property or method call in consuming JSON object From ASP.NET MVC In Internet Explorer

Recently, I've followed a simple tutorial regarding consuming JSON object in ASP.NET MVC. The error stated from the title of this post appears in IE9. The original snippet is this: $(document).ready( $.getJSON( 'http://localhost:6222/home/customerjson' , function (item) { $( '#result' ) //show product name in .html( '<p>' + item.CurrentCustomer.CustomerName + '</p>' ); } ) ); The solution is to enclose $.getJSON() in a function() statement based from the modified code below. The popup script just went away. $(document).ready( function (){ $.getJSON( 'http://localhost:6222/home/customerjson' , function (item) { $( '#result' ) //show product name in .html( '<p>' + item.CurrentCustomer.CustomerName + '</p>' ); } ) ...

Eliminate Duplicate Rows In A DataTable In C#

Assuming you have a datatable that has merged contents from different datatables and you want to eliminate the datatable with distinct rows, you can use the statement below. dt.DefaultView.ToTable( true , new string [] { "id" , "name" }); Cheers!

Column 'column_name' Already Belongs To Another DataTable in C#

In a scenario where I added columns using AddRange(), I encountered an error as specified by the title. Here's the C# code: table1.Columns.AddRange( new DataColumn[] { col1, col2, col3 }); table2.Columns.AddRange( new DataColumn[] { col1, col2, col3 }); Where col1, col2, col3 are DataColumn objects. What I did was to initialize columns in the addrange method. But there are other solutions in the forums. table1.Columns.AddRange( new DataColumn[] { new DataColumn( "ID" ), new DataColumn( "WEB ID" ), new DataColumn( "URL" ) }); table2.Columns.AddRange( new DataColumn[] { new DataColumn( "ID" ), new DataColumn( "WEB ID" ), new DataColumn( "URL" ) });

Donate