topical media & game development

talk show tell print

mashup-amazon-08-08-02-YahooREST-Default.aspx.cs / cs



  using System;
  using System.Data;
  using System.Configuration;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Web.UI.HtmlControls;
  using System.Xml;
  using System.IO;
  
  public partial class _Default : System.Web.UI.Page 
  {
     protected void Page_Load(object sender, EventArgs e)
      {
          Repeater1.DataBind();
      }
  
     
      protected void Submit1_ServerClick1(object sender, EventArgs e)
      {
          string strKeywords = this.txtKeywords.Value; 
          
          if (strKeywords != "")
          {
              XmlDocument myDoc = webUtility.GetUri("http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=[YOUR ID HERE]&query=" + strKeywords + "&results=10&start=1");
              
              XmlNodeReader myReader = new XmlNodeReader(myDoc);
                  DataSet ds = new DataSet();
                  ds.ReadXml(myReader);
              this.Repeater1.DataSource = ds.Tables[1].DefaultView;
              Repeater1.DataBind();           
          }
      }
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.