在VS2005中 ASP.NETppt母版版...

如何在母版页中使用ASP.NET AJAX?_百度知道
如何在母版页中使用ASP.NET AJAX?
该怎么用还怎么用,只要子页套用了该母版页,子页中的html控件在母版页js中都可以获取得到。你在ajax的url中标明到哪个方法就行
其他类似问题
34人觉得有用
母版页的相关知识
按默认排序
其他2条回答
把ScriptManager放到模板里
平时怎么用的,母版页就怎么用,没区别
您可能关注的推广
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Asp.net-vs2005,创建母版页_源代码_实例 - 下载频道
- CSDN.NET
&&&&Asp.net-vs2005,创建母版页_源代码_实例
Asp.net-vs2005,创建母版页_源代码_实例
vs2005中创建母版页_源代码_实例,代码演示!
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
您可能还需要
开发技术下载排行vs2005用母版页的新网页怎么引入新的CSS文件
[问题点数:20分]
vs2005用母版页的新网页怎么引入新的CSS文件
[问题点数:20分]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
相关帖子推荐:
2011年12月 扩充话题大版内专家分排名第二2011年8月 扩充话题大版内专家分月排行榜第二2011年5月 扩充话题大版内专家分月排行榜第二2011年4月 扩充话题大版内专家分月排行榜第二2010年9月 扩充话题大版内专家分月排行榜第二
2011年7月 挨踢职涯大版内专家分月排行榜第三2010年10月 扩充话题大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。1598人阅读
在ASP.NET的母版页中使用图片和超链接
在母版页中使用相对地址的时候要特别小心.特别是在母版页中添加图片和超链接的时候。HTML标记或ASP.NET控件中,相对地址的解析是不一样的。
如果你在ASP.NET控件中使用相对地址,相对地址被解析为相对母版页的地址,例如,假设你在母版页中添加了一个图片:
&asp:Image ImageUrl=&Picture.gif& Runat=&Server& /&
如果母版页在一个MasterPages文件夹中,这个地址会被解析为:
/MasterPages/Picture.gif
如果引用母版的内容页在另一个不同的文件夹中,图片地址还是会被解析为这个相对于母版页的地址。
在HTML标记中使用相对地址则不同,这个图片地址会被解析为相对于引用母版页的内容页的地址。
解决的方法有三个:
第一种方法,把HTML标记替换成ASP.NET标记。
第二种方法,使用绝对地址,而不是相对地址,例如,在名为MyApp的应用程序中,可以使用以下&img&标签来显示在MasterPages文件夹中的图片:
&img src=&/MyApp/MasterPages/Picture.gif& /&
第三种方法,在母版页中使用方法来重新解析相对地址,如程序清单5.10所示。
我的解决办法:
1、把母版页和引用页都放在项目根目录下,想把母版页放在主题文件夹下的,系统不让。
2、把母版用的图片放在主题文件夹下,和CSS文件在一起。
01.&%@ Master Language=&VB& %&&
02.&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.1//EN&&
03.&http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&&&
<img alt="Website Logo" src="" />
You must be careful when using relative URLs in a Master Page. For example, you must be careful when adding images and links to a Master Page. Relative URLs are interpreted in different ways, depending on whether they are used with HTML tags
or ASP.NET controls.
If you use a relative URL with an ASP.NET control, then the URL is interpreted relative to the Master Page. For example, suppose that you add
the following ASP.NET Image control to a Master Page:
&asp:Image ImageUrl=&Picture.gif& Runat=&Server& /&
The ImageUrl property contains a relative URL. If the Master Page is located in a folder namedMasterPages, then the URL is interpreted like this:
/MasterPages/Picture.gif
Even if a content page is located in a completely different folder, theImageUrl is interpreted relative to the folder that contains the Master Page and not relative to the content page.
The situation is completely different in the case of HTML elements. If an HTML element such as an&img& or&a& tag includes a relative URL, the relative URL is interpreted relative to the content page. For example, suppose
you add the following&img& tag to a Master Page:
&img src=&Picture.gif& /&
The src attribute contains a relative URL. This URL is interpreted relative to a particular content page. For example, if you request a content page located in a folder namedContentPages, the relative URL is interpreted
like this:
/ContentPages/Picture.gif
Using relative URLs with HTML elements is especially tricky because the URL keeps changing with each content page. If you request content pages from different folders, the relative URL changes. There are three ways that you can solve this
First, you can replace all the HTML elements that use relative URLs with ASP.NET controls. An ASP.NET control automatically reinterprets a relative URL as relative to the Master Page.
Relative URLs used by ASP.NET controls in a Master Page are automatically reinterpreted relative to the Master Page. This process of reinterpretation is calledrebasing. Only ASP.NET control properties decorated
with theUrlProperty attribute are rebased.
Second, you can avoid relative URLs and use absolute URLs. For example, if your application is named MyApp, then you can use the following&img& tag to display an image file located in theMasterPages folder:
&img src=&/MyApp/MasterPages/Picture.gif& /&
The disadvantage of using absolute URLs is that they make it difficult
to change the location of a web application. If the name of your application changes, then the absolute URLs will no longer work and you'll end up with a bunch of broken images and links.
Another option is to use a method to reinterpret relative URLs in a Master Page. For example, the Master Page in includes a method namedMasterUrl(). This method is used with the&img&
tag in the body of the Master Page, which displays the website logo.
Listing 5.10. MasterPages\ImageMaster.master
&%@ Master Language=&VB& %&
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.1//EN&
&http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&&
&script runat=&server&&
Public Function MasterUrl(ByVal url As String) As String
Return String.Format(&{0}/{1}&, Me.TemplateSourceDirectory, url)
End Function
&html xmlns=&http://www.w3.org/1999/xhtml& &
&head id=&Head1& runat=&server&&
&title&Image Master&/title&
&form id=&form1& runat=&server&&
&img src='&%=MasterUrl(&Logo.gif&) %&' alt=&Website Logo& /&
&asp:contentplaceholder id=&ContentPlaceHolder1& runat=&server& /&
The Master Page in
is located in a folder namedMasterPages. This folder also includes an image namedLogo.gif. This image is displayed with the following HTML tag:
&img src='&%=MasterUrl(&Logo.gif&) %&' alt=&Website Logo& /&
The MasterUrl() method appends the image's filename to the value of the Master Page'sTemplateSourceDirectory property. TheTemplateSourceDirectory property represents the folder that contains the Master Page.
The content page in uses the
Master Page and correctly displays the website logo (see):
Figure 5.5. Displaying a Master Page relative image.
Listing 5.11. ImageContent.aspx
&%@ Page Language=&VB& MasterPageFile=&~/MasterPages/ImageMaster.master& %&
&asp:Content
ID=&Content1&
ContentPlaceHolderID=&ContentPlaceHolder1&
Runat=&Server&&
&h1&Content&/h1&
&/asp:Content&
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:216677次
积分:4294
积分:4294
排名:第2326名
原创:139篇
转载:23篇
评论:350条
阅读:5753
阅读:5437
(1)(3)(1)(2)(2)(1)(5)(4)(4)(1)(2)(5)(4)(15)(1)(1)(16)(39)(14)(2)(1)(14)(22)(4)用vs2010的asp.net做WebSite,如何在母版中做左侧导航树?_百度知道
直接写Html就好了,用&ul&&li&导航一&/li&&li&导航二&/li&&li&导航三&/li&&li&导航四&/li&&li&导航五&/li&&/ul&
然后用CSS去控制样式
其他类似问题
按默认排序
其他2条回答
treeview控件可能更适合做左侧菜单栏,加上xml数据填充,效果很好。
vs2010的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 什么是幻灯片母版 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信