protected void DataPagerPublished_PreRender(object sender, EventArgs e) { List <Comment> comments = new List <Comment>(); using (Service1Client client = new Service1Client()) { GetPublishedCommentsResponse response = client.GetPublishedComments(); if (!response.Errored) { comments = response.Comments.ToList <Comment>(); } } // Fill the listview with data Published_Comments.DataSource = comments; Published_Comments.DataBind(); }
public List <ServiceReference1.Comment> GetComments() { List <ServiceReference1.Comment> res = new List <ServiceReference1.Comment> (); using (var client = new Service1Client()) { GetPublishedCommentsResponse response = client.GetPublishedComments(); if (!response.Errored) { Comment[] comms = response.Comments; foreach (Comment c in comms) { res.Add(c); } } } return(res); }