将asp.net代码转换为WebPart代码问题
我将 SharePoint Server 2007 Enterprise 与 Windows Server 2008 Enterprise 结合使用。我正在使用 VSTS 2008 + C# + .Net 3.5 + ASP.Net 进行开发。我有以下代码,可以在 ASP.Net (aspx) 中正常工作,并且我想在 WebPart 中实现相同的功能并部署到 SharePoint 发布门户网站的页面中。
有什么想法如何实施吗?我主要的困惑是如何处理以下代码的头部部分的代码?有参考代码或文档吗?
这是我正在使用的aspx代码,
<!doctype html>
<html lang="en">
<head>
<title>Test</title>
<link type="text/css" href="tabcontrol/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="tabcontrol/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
</head>
<body>
<div class="demo">
<div id="tabs">
<ul>
<li><a href="#tabs-1">tab1</a></li>
<li><a href="#tabs-2">tab2</a></li>
</ul>
<div id="tabs-1">
<p>tab1 info</p>
</div>
<div id="tabs-2">
<p>tab2 info</p>
</div>
</div>
</div>
</body>
</html>
提前致谢, 乔治
I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net. I have the following code which works correctly in ASP.Net (aspx) and I want to implement the same function in a WebPart and deploy into a page of SharePoint publishing portal site.
Any ideas how to implement? My major confusion is how to deal with the code in the head part of the following code? Any reference code or document?
Here is the aspx code I am using,
<!doctype html>
<html lang="en">
<head>
<title>Test</title>
<link type="text/css" href="tabcontrol/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="tabcontrol/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
</head>
<body>
<div class="demo">
<div id="tabs">
<ul>
<li><a href="#tabs-1">tab1</a></li>
<li><a href="#tabs-2">tab2</a></li>
</ul>
<div id="tabs-1">
<p>tab1 info</p>
</div>
<div id="tabs-2">
<p>tab2 info</p>
</div>
</div>
</div>
</body>
</html>
thanks in advance,
George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查此链接...
http://dotnet.org.za/zlatan/archive/2007/10/12/developing-ajax-web-parts-in-sharepoint-2007.aspx
http://www.bewise .fr/article/ptc/57/WSS-V3-Use-ASP-NET-AJAX-Framework-with-WSS-30.aspx
如果您需要帮助,请告诉我,我可以为您提供 WebPart 示例。
要包含 css 或 js 文件,您可以执行以下操作...
在此示例中,我动态包含 MyMainModalDialog.css 和 MyButtons.css
Check this links...
http://dotnet.org.za/zlatan/archive/2007/10/12/developing-ajax-web-parts-in-sharepoint-2007.aspx
http://www.bewise.fr/article/ptc/57/WSS-V3-Use-ASP-NET-AJAX-Framework-with-WSS-30.aspx
If you need help tell me that I can provide you a WebPart sample.
To include css or js files you can do something like this...
In this sample I include MyMainModalDialog.css and MyButtons.css dynamically
对于 CSS,您可以使用 CssLink和 CssRegistration:
我忘记是否有除了 ClientScriptManager 或 Page.Header.Controls.Add() 之外,还有其他处理自定义 javascript 的方法。有一个 CustomJSUrl 类,但它没有似乎与 CssLink 的工作方式不同。
另外,我相信您的格式化脚本
$(function() { $("#tabs").tabs() })
应该挂钩到 page.load 事件而不是< ;head>
块。For the CSS, you can use CssLink and CssRegistration:
I forget if there are other ways to handle custom javascript besides ClientScriptManager or Page.Header.Controls.Add(). There is a CustomJSUrl class but it doesn't seem to operate in the same way that the CssLink works.
Also, I believe your formatting script
$(function() { $("#tabs").tabs() })
should be hooked to the page.load event rather than in the<head>
block.