dimanche 26 juin 2016

Calendar ID in linq

I try to get calendar ID in LINQ .. So I try this query

T1 ts = new T1();
var list1 = ts.table2.ToList();
var list1 = ts.table2.ToList();
var dq = (from reg_data in list1
          join re in ts.table1 on reg_Data.RID equals re.RID
          where reg_data.RID == Convert.ToInt32(regiondrop.SelectedValue)
          || (re.startdate == fromdate.Value && re.enddate == todate.Value)
          orderby reg_data.OName
          select new
          {
              ID = reg_data.ID,
              OName = reg_data.OName,
              RegNo = reg_data.RegNo,
              RID = reg_data.RID
          }).ToList();
GridView1.DataSource = dq;
GridView1.DataBind();

But there is error in fromdate and todate:

The name 'todate' does not exist in the current context

The name 'fromdate' does not exist in the current context

HTML:

<input type="text" ID="fromdate" /> 
<input type="text" ID="todate" />

So how I get this fromdate and todate in query?

Any solution please?

Aucun commentaire:

Enregistrer un commentaire