Search This Blog

Thursday, November 18, 2010

Retrive data from multiple table using WCF service

Retrive data from multiple table using list<> in WCF service

>> Here i have two tables one is Emp and second one is Contact table
I went to retrive data from both table than i create one collection using List<> and create temp class...is name as empdetail..



[OperationContract]
    public List<Empdetail> getpiza(int id)
    {
       var s = (from a in obj.Emp
                 join b in obj.contacts on a.id equals b.Emp.id
                 where a.id == id
                 select new Empdetail
                 {
                  name= a.name,
                   city=  a.city,
                    email=b.email
                 });

        return s.ToList();
    }
    [DataContract]
    public class Empdetail
    {
        [DataMember]
        public string name { set; get; }
        [DataMember]
        public string city { set; get; }
        [DataMember]
        public string email { set; get; }
    }

Monday, November 15, 2010

How to Redirect in New window

 protected void Button1_Click1(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "window.open('default.aspx')", true);
    }