Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataClasses1DataContext dataContext = new DataClasses1DataContext();
            
            GridView1.DataSource = from quote in dataContext.Quotes
                                   select quote;
                                   

            GridView1.DataBind();
        }
Пример #2
0
        protected void btn_filter_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext dataContext = new DataClasses1DataContext();
            var query = dataContext.Quotes.AsQueryable();
            if(txt_symbol.Text != "")
            {
                query = query.Where(p => p.symbol == txt_symbol.Text);
            }
            if (txt_high.Text != "")
            {
                query = query.Where(p => p.high == Convert.ToDouble(txt_high.Text));
            }
            if (txt_low_min.Text != "")
            {
                query = query.Where(p => p.low > Convert.ToDouble(txt_low_min.Text));
            }
            if (txt_low_max.Text != "")
            {
                query = query.Where(p => p.low < Convert.ToDouble(txt_low_max.Text));
            }

            GridView1.DataSource = query;
            GridView1.DataBind();
        }