Page view counter

Problem w/ EditURL in HTML of User Control

Last post 01-10-2006 12:23 PM by flanakin. 7 replies.

Sort Posts:

  • Problem w/ EditURL in HTML of User Control

    08-17-2005, 8:42 AM
    • Loading...
    • prthompson61
    • Joined on 11-21-2004, 9:21 AM
    • S Berwick, ME
    • Posts 9
    • Points 45
    I've been following the Seabury Design videos on creating a custom module (good work, Todd! Thx!)  All the code in the C# code-behind file has worked great, however, I can't get the EditURL() method call to work from HTML.  In the video, he copied the following code from the FAQs.ascx and pasted it into the .ascx file for the new module (this is the code which displays the edit link as the pen icon):

           <asp:HyperLink NavigateUrl='<%# EditURL("ItemID",DataBinder.Eval(Container.DataItem,"ItemID")) %>' Visible="<%# IsEditable %>" runat="server" ID="Hyperlink1"><asp:Image ID=Hyperlink1Image Runat=server  ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%#IsEditable%>" resourcekey="Edit"/></asp:hyperlink>

    All we need to do is change the two occurrences of ItemID to whatever our key field is.  But it blows up in the browser.  I whittled it down to just this: 

           <asp:HyperLink NavigateUrl='<%# EditURL("foo","22") %>' runat="server" ID="Hyperlink1">-link-</asp:HyperLink>

    But this also blows up (and just including the code to display the pen icon also blows up), here's the stacktrace in the browser:

           Unhandled error loading module.
    DotNetNuke.Services.Exceptions.ModuleLoadException: External component has thrown an exception. ---> System.Web.HttpException: External component has thrown an exception. ---> System.Web.HttpCompileException: External component has thrown an exception. at System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Compilation.BaseCompiler.GetCompiledType() at System.Web.UI.UserControlParser.CompileIntoType() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

    BTW, here's the directive for my user control (since I suspect that may be involved):
            <%@ Control Language="c#" AutoEventWireup="false" Codebehind="AI_Blog.ascx.cs" Inherits="AbstractInstance.DNN.Modules.AI_Blog.AI_Blog" %>

    Any ideas, folks?  Thx for helping out a DNN newbie!
    -Pete

  • Re: Problem w/ EditURL in HTML of User Control

    08-19-2005, 12:02 PM
    • Loading...
    • slimgribnik
    • Joined on 08-05-2005, 8:54 PM
    • Posts 1
    • Points 5
    From another newbi -- I think your on the right track, I came across this and it turned out simple syntax. Use "EditUrl" and not "EditURL" (notice the captialization). And also, watch the type when you return a number in the argument. In this example, I'm return a decimal, hence the "{0:d)"

    I also tried the Seabury example using C#, think this was the only real problem I had and I got it to work. The exact code I used:

    ---------
    <asp:HyperLink NavigateUrl='<%# EditUrl("ItemID",DataBinder.Eval(Container.DataItem,"ItemID","{0:d}")) %>' Visible="<%# IsEditable %>" runat="server" ID="Hyperlink1"><asp:Image ID=Hyperlink1Image Runat=server ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="<%#IsEditable%>" resourcekey="Edit"/></asp:HyperLink>
    ---------

    BTW - Fab job, Todd! Thanks!  My first attempt at ASP.NET, C# and DotNetNuke and it sure taught me tons. Never would have figured anything out myself. (former Jscript developer newly converted).

    --Ron



  • No [Nope] Re: Problem w/ EditURL in HTML of User Control

    08-19-2005, 10:14 PM
    • Loading...
    • prthompson61
    • Joined on 11-21-2004, 9:21 AM
    • S Berwick, ME
    • Posts 9
    • Points 45
    Thanks for your response, Slim!  I tested it tonight and the case for "EditUrl" and the return type didn't help.  I'm thinking it's more than that, I don't think the code render block can find the EditUrl() method at all. As a test, I tried the following and even this didn't work:
       <asp:HyperLink NavigateUrl='<%# EditUrl("foo",2) %>' runat="server" ID="Hyperlink1">-edit-</asp:HyperLink>

    What's weird is the code that Todd uses is copied directly from FAQs.ascx and the Edit link works from there fine for me!

    I installed DNN w/o the source since that was easiest but now I don't know where the EditUrl() method even is.  So I need to read the installation guide and go through the process of installing so I have the source.  Then I'll install my test module and see if I get any further.

    Let me know if you have any new ideas though ...

    -Pete
  • Re: Problem w/ EditURL in HTML of User Control

    09-16-2005, 4:08 PM
    • Loading...
    • JayPak
    • Joined on 03-04-2003, 3:06 PM
    • Posts 19
    • Points 95
     prthompson61 wrote:
    Thanks for your response, Slim!  I tested it tonight and the case for "EditUrl" and the return type didn't help.  I'm thinking it's more than that, I don't think the code render block can find the EditUrl() method at all. As a test, I tried the following and even this didn't work:
       <asp:HyperLink NavigateUrl='<%# EditUrl("foo",2) %>' runat="server" ID="Hyperlink1">-edit-</asp:HyperLink>

    What's weird is the code that Todd uses is copied directly from FAQs.ascx and the Edit link works from there fine for me!

    I installed DNN w/o the source since that was easiest but now I don't know where the EditUrl() method even is.  So I need to read the installation guide and go through the process of installing so I have the source.  Then I'll install my test module and see if I get any further.

    Let me know if you have any new ideas though ...

    -Pete


    Any luck with this?  I'm stuck in the exact same place....

    Thanks!
  • Re: Problem w/ EditURL in HTML of User Control

    09-20-2005, 7:46 AM
    • Loading...
    • prthompson61
    • Joined on 11-21-2004, 9:21 AM
    • S Berwick, ME
    • Posts 9
    • Points 45
    JayPak-

    No I haven't been back to check on this, I've punted the issue for now.  I'm designing an app and played around enough to determine if using DNN would meet my needs, it does.  So now I'm working on a different part of my app since integrating it w/ DNN will be a couple months down the road I expect.  Unfortunately, it's difficult to debug such an issue since the code is not in the code-behind file.  But it has to be a config issue somehow where the EditUrl() method can't be found.  If you get anywhere w/ this, I'd def appreciate it if you'd let me know ... Confused [8-)]

    Thx,
    -Pete
  • Re: Problem w/ EditURL in HTML of User Control

    09-20-2005, 6:04 PM
    • Loading...
    • zperlcoder
    • Joined on 09-20-2005, 9:50 PM
    • Posts 1
    • Points 5
    Pete,

    I was having the same issue and here is the fix that worked for me:

    two things:

    1. as mentioned previously, the "EditUrl" case sensitivity
    2. the other problem was the .ToString() as shown here: EditUrl("ItemID",DataBinder.Eval(Container.DataItem,"ItemID").ToString())

    Hope this helps
  • Re: Problem w/ EditURL in HTML of User Control

    01-10-2006, 11:27 AM
    • Loading...
    • flanakin
    • Joined on 10-05-2003, 3:06 PM
    • Washington, DC area
    • Posts 384
    • Points 1,901
    I'm having the same problem. It's not case-sensitivity, I've verified that. I even try to use EditURL() with no parameters and it doesn't work, either. Has anyone else found a way around this problem?
    Michael Flanakin | Microsoft Consulting Services
    www.michaelflanakin.com
  • Re: Problem w/ EditURL in HTML of User Control

    01-10-2006, 12:23 PM
    • Loading...
    • flanakin
    • Joined on 10-05-2003, 3:06 PM
    • Washington, DC area
    • Posts 384
    • Points 1,901
    Here's a crazy one... try EditUrl(). I just tried it and it worked. Everything I saw said EditURL(), but either it changed pre-3.1 or it was just wrong. Who knows.
    Michael Flanakin | Microsoft Consulting Services
    www.michaelflanakin.com
Page 1 of 1 (8 items)