Exemplo n.º 1
0
 protected void ButtonSearch_Click(object sender, EventArgs e)
 {
     if (TextBoxSearch.Text.Length > 0)
     {
         //DataTable resultTable = StockApi.symbolSearch(TextBoxSearch.Text, apiKey: Session["ApiKey"].ToString());
         DataTable resultTable = StockApi.symbolSearchAltername(TextBoxSearch.Text, apiKey: Session["ApiKey"].ToString());
         if (resultTable != null)
         {
             DropDownListStock.Items.Clear();
             DropDownListStock.DataSource     = null;
             DropDownListStock.DataTextField  = "Name";
             DropDownListStock.DataValueField = "Symbol";
             DropDownListStock.DataSource     = resultTable;
             DropDownListStock.DataBind();
             ListItem li = new ListItem("Select Stock", "-1");
             DropDownListStock.Items.Insert(0, li);
             //ddlPortfolios.Items.Clear();
             labelSelectedSymbol.Text = "Selected stock: ";
         }
         else
         {
             //Response.Write("<script language=javascript>alert('" + common.noSymbolFound + "')</script>");
             Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noSymbolFound + "');", true);
         }
     }
     else
     {
         //Response.Write("<script language=javascript>alert('" + common.noTextSearchSymbol + "')</script>");
         Page.ClientScript.RegisterStartupScript(GetType(), "myScript", "alert('" + common.noTextSearchSymbol + "');", true);
     }
 }