aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
Advertise Here

Advertize

{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, January 18, 2012
In this example you will see that what is difference between Enumerable.First() method and Enumerable.FirstOrDefault() method. More
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, August 28, 2011
The following code example demonstrates how to fetch top five records from a list using Linq query... More
Tags: , ,
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, August 28, 2011
This example demonstrates how to check multiple values using Linq to find out the required result... More
{#advanced_dlg.about_title}
by Aamir Hasan   on Tuesday, June 7, 2011
In this tutorial you will see if Gender is F we will convert it into Female and if result is M we will convert it into Male and other cases we will convert into Other using Linq case statement. More
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, March 13, 2011
You will see that how to find out duplicate string using linq in asp.net. In order to find duplicate we will use GroupBy method and if any group has a count greater then 1, it’s is a duplicate. More
{#advanced_dlg.about_title}
by Aamir Hasan   on Monday, December 6, 2010
Yesterday developer asked me, distinct method on a column using linq is not woking. So, i have decided to wite this example in my blog to share with all of you. Let’s startOpen your Visual Studio 2008/2010 from File -> New -> New Web Site. Following is the code of Default.aspx page.<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title></head><body>    <form id="form1" runat="server">    <div>        <asp:GridView ID="GridView1" runat="server">        </asp:GridView>    </div>    </form></body></html>Following is the code of Default.aspx.cs page. protected void Page_Load(object sender, EventArgs e)    {        GridView1.DataSource = from i in getAllEmployee()                               group i by i.FullName into temp1                               select temp1.Key;        GridView1.DataBind();    }    public List<Employee> getAllEmployee()    {        List<Employee> emp = new List<Employee>()        {            new Employee(){ ID=1, FullName="Aamir Hasan", Age=25 },            new Employee(){ ID=2, FullName="Awais Ahmed", Age=21 },            new Employee(){ ID=3, FullName="Saba khan", Age=11 },            new Employee(){ ID=4, FullName="Mahwish Hasan", Age=18 },            new Employee(){ ID=5, FullName="Hina", Age=26 },            new Employee(){ ID=6, FullName="John", Age=24 },            new Employee(){ ID=7, FullName="Aamir Hasan", Age=22 },            new Employee(){ ID=8, FullName="Awais Ahmed", Age=21 },            new Employee(){ ID=9, FullName="Aamir Hasan", Age=20 },          };        return emp;    }    public class Employee    {        public int ID { get; set; }        public String FullName { get; set; }        public int Age { get; set; }    } Note: You can get distinct values of any column by using above  linq query syntax. Output Download Linq-Distinct-column-fetch-records.zip (1.11 kb) See live demo
{#advanced_dlg.about_title}
by Aamir Hasan   on Saturday, November 20, 2010
Serval times this question has been asked from me that how to create linq to SQL connection in asp.net. So, i have decided to write this example here.In this example, I have used northwind database. First, I have created a connection string and establish a connection between object to database, then select [categoryname] from [categories] table.Finally, through loop i have display the category names on the page.Here’s the solution        string connectionString = "Data Source=.;Initial Catalog=Northwind;Integrated Security=True";        using (SqlConnection connection = new SqlConnection(connectionString))        {            using (NorthwindDataContext context = new NorthwindDataContext(connectionString))            {                var query = from c in context.Categories                            select c.CategoryName;                foreach (var title in query)                {                    Response.Write(title);                }            }        }
{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, November 10, 2010
How to find Maximum & Minimum number from a Generic List using Linq to SQL. More
{#advanced_dlg.about_title}
by Aamir Hasan   on Tuesday, November 2, 2010
In this example, I have demonstrate, how to Split a string using Linq query... More
{#advanced_dlg.about_title}
by Aamir Hasan   on Tuesday, November 2, 2010
how to get all Files list from a specific directory using Linq query... More
Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5