i have find a sample to create a Drag and Drop gridview, and success when i was using DLL file. The sample have the source file, DragDropGridView.cs, how can i reference the cs file instaed of the DLL file in a XXX.aspx and XXX.aspx.cs? and where should
I place the code file?
The files .cs or .vb should be placed in the App_Code folder of your website. If they are associated to a web control (aspx or ascx) then just add the files to your project as you normally would.
Remember to mark as answer if this post answered or solved your problem.
I remove the .dll and placed the source code inside the App_code folder. The source code compiles ok, but the build gives this two kind of errors:
Error 1 Could not load file or assembly 'DayPilot' or one of its dependencies. Impossibile trovare il file specificato. c:\inetpub\wwwroot\DayPilotLiteDemo\NonBusinessHours.aspx 2
for the <%@Register tag (ok this sound pretty obvious, since now there isn't the dll)
and
Error 50 Unknown server tag 'daypilot:daypilotcalendar'. c:\inetpub\wwwroot\DayPilotLiteDemo\ShowHours.aspx 10
So i have tried to delete the <% Register Assembly= tag and insert an <% Import Namespace= tag
and the to use some combination of tags to use the component but without
Simply remove the Assembly= property and it works!!!
Explanation: the Assembly= searches for the compiled dll, so of course it doesn't work.
However you need the <% Register directive and not simply the <% Import, because you don't have to only import the namespace but also to use the control inside the aspx page.
rickycrc
Member
42 Points
120 Posts
Source code and DLL file problem
Apr 24, 2009 01:16 AM|LINK
http://www.codeproject.com/KB/webforms/DragAndDropGridView.aspx
i have find a sample to create a Drag and Drop gridview, and success when i was using DLL file. The sample have the source file, DragDropGridView.cs, how can i reference the cs file instaed of the DLL file in a XXX.aspx and XXX.aspx.cs? and where should I place the code file?
b471code3
Star
13877 Points
2598 Posts
Re: Source code and DLL file problem
Apr 24, 2009 03:19 AM|LINK
The files .cs or .vb should be placed in the App_Code folder of your website. If they are associated to a web control (aspx or ascx) then just add the files to your project as you normally would.
rickycrc
Member
42 Points
120 Posts
Re: Source code and DLL file problem
Apr 24, 2009 03:26 AM|LINK
i place this code when i reference a DLL file, how can i reference when i use the code file?
<%@ Register Assembly="Utility" Namespace="Utility" TagPrefix="cc1" %>
TheRed
Member
197 Points
94 Posts
Re: Source code and DLL file problem
May 13, 2009 08:04 AM|LINK
I have the same problem of ricky, anyone has a solution?
In my case, i use the DLL and the code
<%
@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %><
daypilot:daypilotcalendar id="DayPilotCalendar1" .......works...
I remove the .dll and placed the source code inside the App_code folder. The source code compiles ok, but the build gives this two kind of errors:
Error 1 Could not load file or assembly 'DayPilot' or one of its dependencies. Impossibile trovare il file specificato. c:\inetpub\wwwroot\DayPilotLiteDemo\NonBusinessHours.aspx 2
for the <%@Register tag (ok this sound pretty obvious, since now there isn't the dll)
and
Error 50 Unknown server tag 'daypilot:daypilotcalendar'. c:\inetpub\wwwroot\DayPilotLiteDemo\ShowHours.aspx 10
So i have tried to delete the <% Register Assembly= tag and insert an <% Import Namespace= tag
and the to use some combination of tags to use the component but without
__________________________________________________________
The source code have this directory structure:
App_Code -> Web -> Ui -> DayPilotCalendar.cs
DayPilotCalendar.cs code:
using
System;using
System.Collections;using
System.ComponentModel;using
System.Drawing;using
System.Security.Permissions;using
System.Web;using
System.Web.UI;using
System.Web.UI.WebControls;using
DayPilot.Web.Ui.Design; namespace DayPilot.Web.Ui{
/// <summary> /// DayPilot is a component for showing a day schedule. /// </summary> [ToolboxBitmap(typeof(Calendar))][
Designer(typeof(DayPilotCalendarDesigner))] [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] public partial class DayPilotCalendar : DataBoundControl, IPostBackEventHandler{
Any help would be very appreciated
TheRed
Member
197 Points
94 Posts
Re: Source code and DLL file problem
May 13, 2009 08:56 AM|LINK
I have found the solution to use the source code instead of the dll, and it is really really simple, [:O]
I post it for the convenience of all. Put the source code in the App_Code directory (create it if it doesn't exist).
The in the line when you reference the dll:
<%
@ RegisterAssembly="DayPilot"Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>Simply remove the Assembly= property and it works!!!
Explanation: the Assembly= searches for the compiled dll, so of course it doesn't work.
However you need the <% Register directive and not simply the <% Import, because you don't have to only import the namespace but also to use the control inside the aspx page.
So now my code is like this:
<%
@ Register Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %><
DayPilot:DayPilotCalendar ID="DayPilotCalendar1"In your code, of course, you must replace the DayPilot.Web.Ui with the correct namespace used by your classes