第三方控件如何加载以及调用?

<%@ Register TagPrefix="myCompany" TagName="CarCtl" Src="Car.ascx" %>
[C#]
    // Add other code here.

    // Binds the car object to the control declared
    // in the following code.
    myCarCtl.Car = car;
    myCarCtl.DataBind();

    // Add other code here.

    <%-- Control declaration --%>
    <myCompany:CarCtl id="myCarCtl" runat="server" />
如果愿意,也可以使用 LoadControl 方法取代 @ Register 指令,如以下代码所示。
[C#]
// Use the LoadControl method.
    CarCtl = LoadControl("Car.ascx")
    Form.Controls.Add(CarCtl);
    // Insert the remainder of the previous code here.

posted on 2005-03-01 14:14  狂闪工作室  阅读(638)  评论(0)    收藏  举报