这是的的ListView中的方法:protected void lvLink_ItemCreated(object sender, ListViewItemEventArgs e)
{
//当Item为显示状态时.
if (e.Item.ItemType == ListViewItemType.InsertItem)
{
//显示日期控件.
TextBox FInBillDateTextBox = (TextBox)e.Item.FindControl("FInBillDateTextBox");
if (FInBillDateTextBox != null)
{
FInBillDateTextBox.Text = DateTime.Now.ToShortDateString(); //默认为当期时间.
}
//显示入库类型的控件.
DropDownList ddListLinkType = (DropDownList)e.Item.FindControl("ddListLinkType");
DataRowView viewItem = (DataRowView)e.Item.DataItem;
if (viewItem != null && ddListLinkType != null) //找到控件时且为当期插入行时.
{
var row = (InBillsManage.DAL.DataSetLinksMng.T_LinksRow)viewItem.Row;
} }
}
错误提示:
Error 1 The type name 'DAL' does not exist in the type 'InBillsManage.InBillsManage'
以前都是“ctrl + .”引入,然后就可以直接使用,现在报这样的错。
无法相信,“ctrl + .”又能进来,又报错。
我的需求很简单:
就是 从数据库中找出“入库类型”,显示到我的下拉列表中。
{
//当Item为显示状态时.
if (e.Item.ItemType == ListViewItemType.InsertItem)
{
//显示日期控件.
TextBox FInBillDateTextBox = (TextBox)e.Item.FindControl("FInBillDateTextBox");
if (FInBillDateTextBox != null)
{
FInBillDateTextBox.Text = DateTime.Now.ToShortDateString(); //默认为当期时间.
}
//显示入库类型的控件.
DropDownList ddListLinkType = (DropDownList)e.Item.FindControl("ddListLinkType");
DataRowView viewItem = (DataRowView)e.Item.DataItem;
if (viewItem != null && ddListLinkType != null) //找到控件时且为当期插入行时.
{
var row = (InBillsManage.DAL.DataSetLinksMng.T_LinksRow)viewItem.Row;
} }
}
错误提示:
Error 1 The type name 'DAL' does not exist in the type 'InBillsManage.InBillsManage'
以前都是“ctrl + .”引入,然后就可以直接使用,现在报这样的错。
无法相信,“ctrl + .”又能进来,又报错。
我的需求很简单:
就是 从数据库中找出“入库类型”,显示到我的下拉列表中。
1、我先把 namespace 的 “InBillsManage”该为“InBillsManager”即加一个“r”,然后提示新错:在 Global.asax文件
“<%@ Application Codebehind="Global.asax.cs" Inherits="InBillsManage.Global" Language="C#" %>”
2、然后我的ObjectDataSource也找不到,总之是经过了很麻烦的配置,现在行了。
然后我想应该是我的project 的name 和我add 一个Item时,也就是说我的namespace的名称和我的 .aspx文件重名了,应该是这样,所以找不到。
应该是这个原因哦?