Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Skowronek 29 posts 105 karma points
    Jan 24, 2014 @ 00:31
    Skowronek
    0

    Access PageCssClass Literal Class Name

    I'm using the User Control method of embedding contour forms into our site (ASP.NET not MVC), and am trying to access the PageCssClass values rather than how they are written out to the tag using the literal now. Is there a way to access the classnames or do I have to write a parser to derive them from the Literal's text field?

    Thanks.

  • Comment author was deleted

    Jan 24, 2014 @ 10:23

    Yeah no way to retrieve them, i could give you the code that is used to generate if that helps?

  • Skowronek 29 posts 105 karma points
    Jan 24, 2014 @ 16:10
    Skowronek
    0

    That would be great, thanks Tim.

  • Comment author was deleted

    Jan 24, 2014 @ 17:14

    pageCssClass.Text = "class=\"" + Data.XmlHelper.XmlName(formService.Form.Name) + " " + Data.XmlHelper.XmlName(formService.CurrentPage.Caption) + "\"";

  • Comment author was deleted

    Jan 24, 2014 @ 17:14

    public static string XmlName(string caption) {

            if (!string.IsNullOrEmpty(caption))
            {
                string retval = caption;
                //if the caption starts with a number this would cause invalid xml,
                //so adding a n before the number fixes that
                if (Char.IsNumber(retval.Substring(0, 1).ToCharArray()[0]))
                    retval = "n" + retval;
    
                retval = Regex.Replace(retval, @"\W*", "").ToLower();
    
                return retval;
            }
            else
                return string.Empty;
        }
    
  • Skowronek 29 posts 105 karma points
    Jan 24, 2014 @ 17:52
    Skowronek
    0

    Looks like you're doing your own parsing as well. Either way I'd end up having to parse something. Might just be easier to parse out the markup: class="([^"]+)".

    Just in case, formService.CurrentPage is found how? That would be a local member variable to your API right? What does it represent?

    Thanks for the help.

     

  • Skowronek 29 posts 105 karma points
    Jan 24, 2014 @ 20:34
    Skowronek
    0

    Tim, do you you have any documentation on extending Contour ASCX UI as you have provided for the Razor implementation? I've successfully extended the RenderForm.ascx control but am not finding a lot of documentation on modifying the input UI where the placeholder renders. I'm doing a lot of reverse engineering here.

    <!-- The data entry control -->
    <asp:placeholder id="placeholder" runat="server" />

    Thanks.

  • Comment author was deleted

    Jan 27, 2014 @ 10:13

    Nope not recommended to extend that one since you might break some stuff, not as easy as with the razor one

  • Skowronek 29 posts 105 karma points
    Jan 27, 2014 @ 19:14
    Skowronek
    0

    I was able to do what I needed on prerender of the control. Still a hack, but it works.

    Are you planning on doing any enhancements to the ASP.NET version of Contour? Or just planning on enhancing the MVC version? It wouldn't be that difficult to create templated rendering control if you did. Just a thought.

  • Comment author was deleted

    Jan 27, 2014 @ 19:36

    Nope no changes will happen to the usercontrol version, razor one is the prefered option

  • Skowronek 29 posts 105 karma points
    Feb 11, 2014 @ 01:26
    Skowronek
    0

    Tim, would you be willing to discuss extending/maintaining the usercontrol version for those of us who still use Webforms and get better integration when implementing controls this way?

  • Comment author was deleted

    Feb 11, 2014 @ 09:08

    Not sure we'll be putting lot's of effort in that one but open to discuss

    We could share the code for the control if that helps you out 

  • Skowronek 29 posts 105 karma points
    Feb 11, 2014 @ 18:09
    Skowronek
    0

    Absotutely. If you're willing to share the source for the user control method of implementing the macros that would definitely help. How can I get in touch with you? The forums don't provide contact information.

  • Comment author was deleted

    Feb 12, 2014 @ 11:31

    tg at umbraco dot com

  • Comment author was deleted

    Feb 12, 2014 @ 11:34

    But will make it public later this week, just wating on the final ok

  • Comment author was deleted

    Feb 12, 2014 @ 11:57
  • Comment author was deleted

    Feb 12, 2014 @ 11:58

    You'll just need to replace the existing form usercontrol with your custom one then

  • Skowronek 29 posts 105 karma points
    Feb 13, 2014 @ 08:34
    Skowronek
    0

    Awesome! Thank you very much. We'd  be willing to help maintain this (with updates) if you make it a contributable project on Github.

  • Comment author was deleted

    Feb 13, 2014 @ 08:55

    Yeah will do that, thanks that's great :)

Please Sign in or register to post replies

Write your reply to:

Draft