aherlambang
aherlambang

Reputation: 14418

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.ToString("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?

Upvotes: 1

Views: 568

Answers (1)

SLaks
SLaks

Reputation: 888107

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>

Upvotes: 2

Related Questions