选择显示字体大小

如何在asp+ 中使用自定义的pagelet

/*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如转载请注明版权信息
*/

asp+ 中提供了一种类似xml 的 代码描写方法,例如<asp:label id=test runat=server>
在本篇文章里 我会给大家描述一下 如何 编写自己的pagelet 例如:<asp888:mytestmenu
首先我们写一个aspc 文件,这个文件必须在aspx 文件中进行引用
<%@ page language="vb" %>
<%@ import namespace="system.drawing" %>
<script runat=server>
'创建公共变量
public forecolor as color
public backcolor as color
public width as unit
' 创建调用的函数和过程
public sub addmenuitem(byval in_text as string, byval in_url as string)
dim newmenuitem as new tablecell
newmenuitem.text = "<a href='" & in_url & "'>" & in_text & "</a>"
mysubrow.cells.add(newmenuitem) 'mymenu.rows(0).cells.add(newmenuitem)
end sub
sub page_load(byval source as object, byval e as eventargs)
myasptable.backcolor = backcolor
myasptable.width = width
mymenu.forecolor = forecolor
end sub
</script>
<asp:table border =1 id=myasptable runat=server>
<asp:tablerow id=myrow1 runat=server>
<asp:tablecell id=mymaincell runat=server>
<!-- begin nested menu table -->
<asp:table border=1 id=mymenu runat=server
cellpadding=6
cellspacing=0>
<asp:tablerow id=mysubrow>
</asp:tablerow>
</asp:table>
<!-- end nested menu table -->
</asp:tablecell>
</asp:tablerow>
</asp:table>
好了,下面我们看看aspx 文件
<%@ page language="vb" %>
<%@ register tagprefix="asp888" tagname="mytestcontrol" src="menu_control.aspc" %>
<html>
<head>
<script runat=server>
sub page_load(byval sender as object, byval e as eventargs)
menucontrol1.addmenuitem("豆腐技术站", "http://www.asp888.net")
if page.ispostback
menucontrol1.addmenuitem(txtnewmenutext.text, txtnewmenulink.text)
end if
end sub
</script>
</head>

<body>
<asp888:mytestcontrol id="menucontrol1" runat=server
backcolor = "gray"
width="100%"
forecolor="silver" />
<form method=post action=mymenucontrol.aspx runat=server>
<p>
新的联结显示:
<asp:textbox id=txtnewmenutext runat=server />
</p>
<p>
新的联结地址:
<asp:textbox id=txtnewmenulink runat=server />
</p>
<p>
<input type=submit value="submit" runat=server />
</form>
</p>
</body>
</html>
大家运行后,就可以看到这个的直接效果了


作者:豆腐()


  


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons