asp.net 取得用户控件里的属性或控件
最近在用用户控件时,引用户控件的页面有时候会和用户控件进行数据的交互,网上好像很多人不知道何获取
写个例子说明一下
取得用户控件里面的控件并进行赋值
用户控件aspx页代码
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="HeadPanel.ascx.cs" Inherits="HeadPanel" %>
<asp:Label ID="lb1" runat="server" Text=""></asp:Label> //在用户控件里定义 的两个控件
<asp:Label ID="lb2" runat="server" Text=""></asp:Label>
cs页代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class HeadPanel : System.Web.UI.UserControl
{
public static string tmpSiteName = "用户控件进行赋值的标题";
public string tmpStr="这是用户变量";
protected void Page_Load(object sender, EventArgs e)
{
}
}
引用用户控件aspx页代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Src="HeadPanel.ascx" TagName="RegHead" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title><%= HeadPanel.tmpSiteName%></title> //HeadPanel是用户控件cs页的类名,tmpSiteName是用户控件里的静态变量
</head>
<body>
</body>
</html>
引用用户控件cs页代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(
相关文档:
+++ HiddenField01.aspx页面
++ 页面代码如下:
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HiddenField2" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
++ 后台代码,如下:
protected void Button1_C ......
参考 http://topic.csdn.net/t/20040510/19/3051316.html
开始
运行
dcomcnfg
组件服务一项中选择Dcom配置,找到Microsoft excel应用程序,察看属性
安全选项卡中,启动权限和访问权 ......
引用自:http://www.cnblogs.com/suzongwei/archive/2008/11/10/1330377.html
或许 这个更易懂些 代码过程
http://blog.csdn.net/swort_177/archive/2007/12/02/1912159.aspx
对于ASP.NET开发者,理解ASP.NET的页面生命周期是非常重要的。
主要是为了搞明白在哪里放置特定的方法和在何时设置各种页面属性。
但是记忆和 ......
MVC2 框架安装完成以后我们就可以开始我们的 MVC之旅了,呵呵
本次学习内容:Route
首先 route 的中文意思就是我们常说的“路由”,确实这里也是这个意思,在我们MVC中已经不再使用 XX.aspx 来访问页面了,
所有页面的请求会通过route来解析找到对应的控制器(controller)里面对应的操作(action)来执行的。
mv ......
方法1
HttpFileCollection files = HttpContext.Current.Request.Files;
//我设置的大小不超过A4纸的缩略图
int newWidth=620;
int newHeight=880;
System.Drawing.Image img = null;
for(int iFile = 0; iFile < files.C ......