哪位仁兄能给些实例或资料,msdn除外,谢谢。

解决方案 »

  1.   

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="news.ascx.cs" Inherits="news" %>
    <table><tr><td>
    <marquee id="scrollNews" onmousemove="stop()" onmouseout="start()" scrollamount="1" scrolldelay="70" direction="up" style="width: 200px; height: 152px">
        <asp:DataList ID="DataList1" runat="server">
        <ItemTemplate>
    <asp:Image id="Image1" runat="server" ImageUrl="~/image/NEW.gif"></asp:Image>&nbsp; <a style="font-family:楷体_GB2312; font-size: 11pt;" href='news.aspx?newsid=<%# DataBinder.Eval(Container.DataItem,"newsID") %>'><%# DataBinder.Eval(Container.DataItem,"header") %></a>
    </ItemTemplate>
        </asp:DataList></marquee>
    </td></tr></table>
    网页内引用
    <%@ Register Src="~/news.ascx" TagName="news" TagPrefix="uc1" %><uc1:news ID=news1 runat=server />
      

  2.   

    asp.net 2.0 服务器与组件开发高级编程
      

  3.   

    下面代码是从asp.net programming 里COPY出来的,控件是从BUTTON继承来的,加他点击次数功能.新建自定义控件步骤如下:
    文件>新建项目>windows>WEB控件库
    然后你试试将下面代码粘贴上去
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;namespace CSCustomControl
    {
        [DefaultProperty("Text")]
        [ToolboxData("<{0}:CountedButton runat=server></{0}:CountedButton>")]
        public class CountedButton : Button
        {
            [Bindable(true)]
            [Category("Appearance")]
            [DefaultValue("")]
            [Localizable(true)]
            public CountedButton()
            {
                this.Text = "Click Me";
                ViewState["count"] = 0;
            }
            public int Count
            {
                get { return (int)ViewState["count"]; }
                set { ViewState["count"] = value; }
            }
            protected override void OnClick(EventArgs e)
            {
                ViewState["count"] = ((int)ViewState["count"]) + 1;
                this.Text = string.Format("{0} clicks", ViewState["count"]);
                base.OnClick(e);
            }
        }
    }
    将这个项目生成后,使用方法如下
    1.在网站添加生成的DLL
    2.添加控件注册指令
    <%@ Register Assembly="CSCustomControl" Namespace="CSCustomControl" TagPrefix="cc1" %>
    3.使用就象<cc1:WebCustomControl1 ID="WebCustomControl1_1" runat="server" Text="Hi,竹子" />
    就这样了.------------CSDN竹子专享签名功能-----------------------------------------------------
    如果问题解决,请结贴,谢谢!不知道怎么结贴?请单击我
    如有仍有其它问题,请继续顶贴。
    ------------------------------------------------------------------------------------