Ejemplo n.º 1
0
    protected void Search_Click(object sender, EventArgs e)
    {
        Array Data = null;

        NewsServiceReference1.NewsServiceClient newsClient = new NewsServiceReference1.NewsServiceClient();
        Data = newsClient.GetNews(txtBoxQuery.Text);
    }
Ejemplo n.º 2
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        Array Data = null;

        NewsServiceReference1.NewsServiceClient newsProxy = new NewsServiceReference1.NewsServiceClient();
        Data = newsProxy.GetNews(txtQuery.Text);
        DataTable table = new DataTable();

        table.Columns.Add("Title", typeof(string));
        table.Columns.Add("Description", typeof(string));
        table.Columns.Add("Url", typeof(string));


        for (int i = 0; i < Data.Length; i++)
        {
            DataRow entry = table.NewRow();
            entry["Title"]       = ((NewsServiceReference1.NewsType[])(Data))[i].Title;
            entry["Description"] = ((NewsServiceReference1.NewsType[])(Data))[i].Description;
            entry["Url"]         = ((NewsServiceReference1.NewsType[])(Data))[i].Url;

            table.Rows.Add(entry);
        }
        GridView1.DataSource = table;
        GridView1.DataBind();
    }