Beispiel #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());

                if (resultTable != null)
                {
                    DropDownListStock.DataTextField  = "Name";
                    DropDownListStock.DataValueField = "Symbol";
                    DropDownListStock.DataSource     = resultTable;
                    DropDownListStock.DataBind();
                    ListItem li = new ListItem("Select Stock", "-1");
                    DropDownListStock.Items.Insert(0, li);
                    ViewState["GraphScript"] = "Search & Select script";
                    labelSelectedSymbol.Text = "Search & Select script";
                }
                else
                {
                    Response.Write("<script language=javascript>alert('" + common.noSymbolFound + "')</script>");
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('" + common.noTextSearchSymbol + "')</script>");
            }
        }