开发者

problem with .dll in aspx page

I have added an assembly to my project and then uses the assembly as follows:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Global.Master" AutoEventWireup="true" CodeBehind="Calendar.aspx.cs" Inherits="Permias.Calendar" %>
<%@ Register TagPrefix="ec" Namespace="ControlSample" Assembly="EventCalendar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="content">
            <div class="post">
                <ec:EventCalendar runat="server" ID="eventscalendar" DataSourceID="sqldatasource1"
                BorderWidth="0" DayField="starttime" ShowTitle="true" CssClass="eventmonthtable">
                <DayHeaderStyle CssClass="caldays" />
                <DayStyle CssClass="calcurrentmonth" />
                <TodayDayStyle CssClass="calcurrentday" />
                <WeekendDayStyle CssClass="calweekend" />
                <OtherMonthDayStyle CssClass="calothermonth" />
                <DayNumberStyle CssClass="dayNumber" />
                <HeaderTemplate>
                    <table width="100%">
                        <tr align="center">
                            <td>
                                <asp:LinkButton ID="PrevMonth" runat="server" Text='<%# "&laquo; " + Container.PrevMonth.ToStrin开发者_如何学Pythong("MMMM yyyy") %>'
                                    CommandName="PrevMonth" />
                            </td>
                            <td>
                                <h3>
                                    <asp:Label ID="label2" runat="server" Text='<%# Container.CurrentMonth.ToString("MMMM yyyy") %>' /></h3>
                            </td>
                            <td>
                                <asp:LinkButton ID="NextMonth" runat="server" Text='<%# Container.NextMonth.ToString("MMMM yyyy") + " &raquo;" %>'
                                    CommandName="NextMonth" />
                            </td>
                        </tr>
                    </table>
                    <div class="dashedline">
                    </div>
                </HeaderTemplate>
                <DayEventTemplate>
                    <div style="padding: 3px;">
                        <asp:HyperLink ID="HyperLink1" runat="server" Text='<%#Eval("title") %>' NavigateUrl='<%# "Events_view.aspx?Eventid=" + Convert.ToString(Eval("ID"))%>'
                            ToolTip='<%# SharedRoutines.truncate((string)Eval("description")) %>' /></div>
                </DayEventTemplate>
            </ec:EventCalendar>
                </div>
            </div>
    </div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="splash" runat="server">
<div id="splash">&nbsp;</div>
</asp:Content>

However it generates an error saying that:

Compiler Error Message: CS0103: The name 'SharedRoutines' does not exist in the current context

Why is this?


You need to include the namespace containing the SharedRoutines class at the top of the page, like this:

<%@ Import Namespace="Your.Namespace" %>

You can also include it globally in Web.config:

<pages>
    <namespaces>
        <add namespace="Your.Namespace" />
    </namespaces>
</pages>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜