>>>但是编译时总是报错are you trying to access the control in code behind? you need to declare a member variable for your control in your codebehind class
解决方案 »
- 关于IE8的一个session问题。
- GridView分页后怎么记忆每页所选中的RadioButton
- 导出Excel时附带图表向导 +++帮帮忙 ,这个有 点难
- 我用Socket编写的Winforms程序使用了5001端口,是不是还得在路由做端口映射?
- asp.net程序,重装系统后的问题!
- 小问题令我很郁闷
- 关于GET方式传值的问题
- 文本输入框中如何实现完全本地输入
- 我想去深圳
- 怎样实现 TreeView 和 MessageBox.Show 的引用共存???
- 迷惑问题---关于页面重复刷新
- 最近给一家公司做了一个网站现在要发布出去,求一空间(要求:支持asp.net,acess数据库,价格300-400元/每年)。信誉要好。谢谢。
===弯弯的月亮小小的船,小小的船,两头尖,我在小小的船里坐,只看见闪闪
的星星蓝蓝的天.===本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.IO"%>
<script runat="server">
private string _directoryName;
public string DirectoryName
{
get{return _directoryName;}
set{_directoryName=value;}
}
protected void Page_Load(object sender, System.EventArgs e)
{
if((DirectoryName!=null)&&(DirectoryName!=string.Empty))
{
directoryLabel.Text=DirectoryName;
DirectoryInfo dir=new DirectoryInfo(DirectoryName);
foreach(FileSystemInfo fsi in dir.GetFileSystemInfos())
{
MobileListItem item=new MobileListItem(fsi.Name);
fileList.Items.Add(item);
}
}
}
</script><mobile:Label id="directoryLabel" runat="server" FontBold="True"></mobile:Label>
<mobile:List id="fileList" runat="server"></mobile:List>UserControl.aspx文件
<%@ Register TagPrefix="Sample" TagName="Directory" Src="UserControl.ascx"%>
<%@ Page language="c#" Codebehind="MobileWebForm1.aspx.cs" Inherits="UserControl.MobileWebForm1" AutoEventWireup="false" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><script runat="server">
public class MobileWebForm1 : System.Web.UI.MobileControls.MobilePage
{
protected System.Web.UI.MobileControls.Form Form1; public void Page_Load(object sender, System.EventArgs e)
{
m.DirectoryName="c\\Inetpub\\wwwroot";
}
</script><mobile:Form id="Form1" runat="server" Paginate="True">
<Sample:Directory id="m" runat="server" />
</mobile:Form>
<%@ Page language="c#" Codebehind="MobileWebForm1.aspx.cs" Inherits="UserControl.MobileWebForm1" AutoEventWireup="false" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><script runat="server">
public void Page_Load(object sender, System.EventArgs e)
{
m.DirectoryName="c\\Inetpub\\wwwroot";
}
</script><mobile:Form id="Form1" runat="server" Paginate="True">
<Sample:Directory id="m" runat="server" />
</mobile:Form>