HttpClient client = new HttpClient(); client.BaseAddress = new Uri(Base_URL); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); StringContent con = new StringContent(JsonConvert.SerializeObject(up), Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.GetAsync("api/UpdateHotelInfoes"+TextBox2.Text); if (response.IsSuccessStatusCode) { string data = await response.Content.ReadAsStringAsync(); //var A= JsonConvert.DeserializeObject<UpdateHotelInfo>(data); // List<UpdateHotelInfo> a = response.Content.ReadAsAsync<List<UpdateHotelInfo>>().Result; var result = JsonConvert.DeserializeObject<List<UpdateHotelInfo>>(data); GridView1.DataSource = result;
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns = "False" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:BoundField DataField="HOTEL_NAME" HeaderText="HOTEL_NAME" /> <asp:BoundField DataField="ADDRESS_LINE" HeaderText="ADDRESS_LINE" /> <asp:BoundField DataField="AREA" HeaderText="AREA" /> <asp:BoundField DataField="CITY" HeaderText="CITY" /> <asp:BoundField DataField="POSTAL_CODE" HeaderText="POSTAL_CODE" /> <asp:BoundField DataField="STATE" HeaderText="STATE" /> <asp:BoundField DataField="COUNTRY" HeaderText="COUNTRY" /> <asp:BoundField DataField="PHONE_NUMBER" HeaderText="PHONE_NUMBER" /> <asp:BoundField DataField="LANDLINE" HeaderText="LANDLINE" /> <asp:BoundField DataField="EMAIL_ID" HeaderText="EMAIL_ID" /> <asp:BoundField DataField="WEBSITE" HeaderText="WEBSITE" /> <asp:BoundField DataField="PROPERTY_TYPE" HeaderText="PROPERTY_TYPE" /> <asp:BoundField DataField="PROPERTY_GRADE" HeaderText="PROPERTY_GRADE" /> <asp:BoundField DataField="REGISTRATION" HeaderText="REGISTRATION" /> </Columns> <FooterStyle BackColor="#CCCC99" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <RowStyle BackColor="#F7F7DE" /> <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> <SortedAscendingCellStyle BackColor="#FBFBF2" /> <SortedAscendingHeaderStyle BackColor="#848384" /> <SortedDescendingCellStyle BackColor="#EAEAD3" /> <SortedDescendingHeaderStyle BackColor="#575357" /> </asp:GridView>
GridView1.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)