Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: making a template.cs file

  1. #1
    sam.bengtson is offline Member
    Join Date
    Jan 2011
    Posts
    64

    Default making a template.cs file

    Hi i'm trying to create a .cs file for the template page so I can have a login box along the left nav of my site. I am having a hard time making it work, has anybody done this?

    I have a codefile="template.ascx.cs" on the <%control %> tag at the top of the page.
    Here is what my template.ascx.cs file looks like:
    I get the following error. Does anybody know what the correct base class to extend is? I tried to copy this from default.aspx.cs without luck. Thanks
    ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
    Code:
    using System;
    using System.Xml;
    using System.Xml.Xsl;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.IO;
    using System.Web;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Data;
    using System.Data.SqlClient;
    using System.Globalization;
    using AspDotNetStorefrontCore;
    using ASPDNSFControls;
    using AspDotNetStorefrontGateways;
    using System.Collections.Generic;
    using AspDotNetStorefrontCore.ShippingCalculation;
    
    namespace AspDotNetStorefront
    {
    
        public partial class TemplateBase : Control
        {
            static void refreshControl()
            {
    
                headerlabel1.Text = "whoo";
    
            }
    
           
        }
    }

  2. #2
    sam.bengtson is offline Member
    Join Date
    Jan 2011
    Posts
    64

    Default

    Any Suggestions? I am trying to change the visibility of one of my div's in the template file, thats why I need to make/find the codebehind for template.ascx.

  3. #3
    Muckman is offline Junior Member
    Join Date
    Jun 2010
    Posts
    14

    Default

    Hi,

    For ML9:

    regarding the login Question: I've created a new controll which i render on relevant pages. keep in mind, that you should "go secure" to avoid transmitting passowrds in cleartext.

    My "Code Behind" relies in App_Code\masterpagebase.aspx.cs - here i determin whether the customer should have access to a quick login, and render this control. (similar to the applogic for minicart)
    I think I've started with the pollcontroll to create the QuickLogin Controll.

    regarding the visibility of DIVs:
    You may use inline code.
    e.g.

    <%
    String s = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"];
    int ix = s.LastIndexOf("/");
    if (ix != -1)
    {
    s = s.Substring(ix + 1);
    }
    %>
    ......

    <%if (!s.StartsWith("p-") { %>
    <div id="myCustomDiv">
    ...
    .
    </div>
    <% }%>