使用内置页框在ASP.NET [英] Using iFrames In ASP.NET

查看:130
本文介绍了使用内置页框在ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站与母版页,我可以使用 IFRAME 所以我的的.aspx 页面将加载内部框架里面。 (这意味着它不会加载该母版页)

I have an asp.net website with a master-page, can I use the iframe so my .aspx pages will load inside the iframes. (Meaning it wont load the master-page)

有点像我的 IFRAME 将是的ContentPlaceHolder 或者在的ContentPlaceHolder 将里面呢?

Kinda like my iframe will be the contentplaceholder or maybe the contentplaceholder will be inside it?

任何想法?

推荐答案

试试这个

<iframe name="myIframe" id="myIframe" width="400px" height="400px" runat =server></iframe>

在母版页的codebehind

让本IFRAME:

Expose this iframe in the master page's codebehind:

public HtmlControl iframe
{
get
{
return this.myIframe;
}
}

添加中的MasterType指令来强类型的母版页的内容页面。

Add the MasterType directive for the content page to strongly typed Master Page.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits=_Default" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>

在code后面

protected void Page_Load(object sender, EventArgs e)
{
this.Master.iframe.Attributes.Add("src", "some.aspx");
}

这篇关于使用内置页框在ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆