Hello,
Normally we all do use using System.Linq;
and using System.Data.Linq;
for example on the code-behind and expect we can reach the members of these namespaces from Source Code like <%= Something.First()%>
but when I wrote it, asp.net said it couldn't find First()
in the context and I had to add <%@ Import Namespace="System.Linq"
which looked very weird to me but it worked out. Since they are targeting at the same class why they both need separate namespace importing.
Code-behind :
using System;
using System.Data.Linq;
using System.Linq;
using System.Text
namespace Something
{
class Items : System.Web.UI
{
//...
}
}
but also I need to add the same Linq namespace on the Html Source part
<%@Import Namespace="System.Linq"%>
Do I know something wrong or this is some kind of bug in asp.net. I thought when the page is compiling, asp.net combines these two classes and converts html source code into cs class and indicates the control in Control c= new Control();
hierarchy.
Thanks in advance.
P.s : I am trying to reach for example First()
in Items.aspx and everything I mentioned about an asp.net page which is Items.aspx