Friday, March 30, 2012

Google Charts

http://chartsandgraphs.care4soft.com/

Monday, March 26, 2012

Passing Comma Separated Param to Reports

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Microsoft.Reporting.WebForms;
using System.Configuration;
using System.Net;


namespace My.Web.Reports
{
public partial class ReportViewer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ICollection rptParams = new List();
ReportParameter rptParam = new ReportParameter();

rptParam.Name = "Id";
rptParam.Values.Add("101,102");

rptParams.Add(rptParam);
rptParam = new ReportParameter();

rptParam.Name = "name";
rptParam.Values.Add("Assam");

rptParams.Add(rptParam);

ReportViewer1.ServerReport.SetParameters(rptParams);
}
}
}
}


-----------DataSet Query----------------

SELECT ID, Name
FROM Product
WHERE (ID IN
(SELECT items
FROM dbo.Split(@Id, ',') AS Split_1)) AND (Name LIKE '%' + @name + '%')

Tuesday, February 21, 2012

Best Practices for Speeding Up Your Web Site

http://developer.yahoo.com/performance/rules.html

Friday, January 20, 2012

Anonymous Functions, Lambda Expression


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace ConsoleApplication.LE_Delegates_An_Mthods
{
public class LambdaExpressions
{
delegate void DelWithoutReturnType(string message);
delegate string DelWithReturnType(string message, int i);

public void Sample1()
{
//Using Anonymous method
DelWithoutReturnType an = delegate(string msg) { Console.WriteLine(msg); };

//Using Method Group
DelWithoutReturnType mg = Console.WriteLine;

//Using Lambda Expression
DelWithoutReturnType le = (msg) => Console.WriteLine(msg);

an("Anonymous");
mg("Method Grp");
le("LE");
}

public void Sample2()
{
//Using Anonymous method
DelWithReturnType an = delegate(string msg, int cnt)
{
Console.WriteLine(msg);
Console.WriteLine();
return msg + cnt;
};

//Using Lambda Expression
DelWithReturnType le = (msg, cnt) =>
{
Console.WriteLine(msg);
return (msg + cnt);
};

an("Something needs to be done", 3);
le("I have changed the above delegate to Lambda Expression", 3);
}


}
}

Tuesday, January 10, 2012

Playing with Inheritance...

public interface IBase
{
void baseDisplay();
}

public interface I1 : IBase
{
void display();
}

public interface I2 : IBase
{
void display();
}


public class BaseB
{
public BaseB()
{
this.display();
}

public virtual void display()
{
Console.WriteLine("Base");
}
}

public class DervB : BaseB, I1, I2
{
public DervB()
{
base.display();
this.display();
display();
display(5);
}
public override void display()
{
base.display();
Console.WriteLine("Derived");
}

void I1.display()
{
Console.WriteLine("Interface I1");
}

void I2.display()
{
Console.WriteLine("Interface I2");
}

public void display(int i)
{
Console.WriteLine("Seperate Method");
}

void IBase.baseDisplay()
{
Console.WriteLine("Base interface");
}
}

-------------------------------------------------------------------------------------------------

static void Main(string[] args)
{
BaseB b = new BaseB();
b.display();
Console.WriteLine("1111------------------------------------");

BaseB b2 = new DervB();
b2.display();
Console.WriteLine("2222------------------------------------");

DervB der = new DervB();
der.display();
der.display(2);
Console.WriteLine("33------------------------------------");

I1 i = new DervB();
i.display();
Console.WriteLine("------------------------------------");


I2 i2 = new DervB();
i2.display();
Console.WriteLine("------------------------------------");

I1 i3 = new DervB();
i3.baseDisplay();
Console.WriteLine("------------------------------------");


Console.ReadLine();
}