易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET跨页面的控件调用

ASP.NET3.5可以很简答的实现一个很有用的功能,既跨页面传送,
传统的提交窗体只会将窗体提交给它自己。而跨页面的提交,
会将page1的内容传送个page2,并在page2中使用page1中的控件。
① 跨页面传递的简单实现
    页面一(Default.aspx)中的控件
        <asp:TextBox ID="txtPageDefault" runat="server"></asp:TextBox>
        <asp:Button ID="btnToPostBackPage" runat="server" Text="跨窗体提交"
            PostBackUrl="~/PostBackPage.aspx" style="height: 21px" /> 
     页面一的后台代码是不需要的,只要PostBackUrl="~/PostBackPage.aspx"这样注明要提交的目标页面就可以了
    页面二(PostBackPage.aspx)前台控件
        <asp:TextBox ID="txtPagePostBack" runat="server"></asp:TextBox>
     页面二后台代码
        TextBox box = (TextBox)PreviousPage.FindControl("txtPageDefault");
        txtPagePostBack.Text = "前窗体内容:" + box.Text;
     由此可以看到,实际上只要对提交按钮的PostBackUrl属性进行设置,就可以在目标页面很容易的访问到被提交的前一页面的空间内容
② 直接通过属性来访问前页面的控件
    编译器会将页面中的控件编译为页面类之外不可访问的类型,所以为了使用PreviousPage类直接访问前页面的内容我们需要用设置属性的方式,将我们需要访问的控件公开
就上一个类子来看,首先我们需要向Default页面的后台田间代码,
表明属性DefaultText 来返回当前页面的TextBox控件
public partial class _Default : System.Web.UI.Page
{
    public TextBox DefaultText
    {
        //定义为只读
        get { return txtPageDefault; }
    }
    protected void Page_Load(object sender, EventArgs e)
   


相关文档:

asp.net 2.0 怎样对label进行绑定

问题描述:
数据库A表中:
ID    Name
1    小明
2    小强
3    小张
4    小李
5    小关
...
分别有Label1,Label2... Label5 五个标签,怎么让这五个标签Text绑定显示A表Name列的前5个,就是说Label1显示小明,Label2显示小强... 
......

使用ASP.NET上传多个文件到服务器

在Email系统中经常会上传多个文件到服务器,用户大多习惯一次上传所有的文件,而不是逐个上传,我们可以使用javascript动态地添加file元素到表单,然后在服务器端处理这些file
效果图如下:
页面代码MutlileFileUpload.aspx如下:
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" C ......

asp.net 发送邮件

  几个月前,做用户注册模块要用到发送邮件功能,也碰到了些或大或小的问题,现在总结一下:
我先贴出发送邮件用到的代码:
public void SendEmail(string stremail, string content,string title)
{
MailMessage mm = new MailMessage();
mm.from = new MailAddress(公司邮箱) ......

Explained: Forms Authentication in ASP.NET 2.0

原地址:
http://msdn.microsoft.com/en-us/library/aa480476.aspx
IIS Authentication
ASP.NET authentication is a two-step process. First, Internet Information Services (IIS) authenticates the user and creates a Windows token to represent the user. IIS determines the authentication mode that it shoul ......

Asp.Net性能优化

(一).选择会话状态存储方式
    在Webconfig文件配置:
    <sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
         sqlConnectionString="data source=127.0.0.1;Trusted_Connection=y ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号