Skip to Content
author's profile photo Former Member
Former Member

Pulling data from .ascx files up to .master files

I'm trying to use some basic info from .ascx files, like product code, in my catalogpartdetail.master. How do I pull that data up? If you could post some sample code, that would be the easiest for me to imitate.

Thanks,

Derek

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 02:16 PM

    If you look in the plugins folder for WebTools all the files have their code in the ascx file (not a code behind) so that would be a good place to see examples of how to access the API.

    Steve

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      This should help get you started with your plugin:

      <%
      {
      		if ((Request.QueryString["ListType"]) == "F"){
      		categoryName.Text = @"Featured Products"; categoryName.Visible = true; 
      		}
      		else if ((Request.QueryString["ListType"]) == "N"){
      		categoryName.Text = @"New Products"; categoryName.Visible = true; 
      		}
      		else if ((Request.QueryString["ListType"]) == "D"){
      		categoryName.Text = @"Sale Items"; categoryName.Visible = true; 
      		}		
      		else if ((Request.QueryString["ParentID"]) != null){
      		NPCatalogCategory pc = new NPCatalogCategory(Convert.ToInt32(Request.QueryString["ParentID"])); 
      		categoryName.Text = pc.CategoryName; categoryName.Visible = true; 
      		}
      		else if ((Request.QueryString["CategoryID"]) == null || (Request.QueryString["CategoryID"]) == ""){
      		categoryName.Text = @"";
      		}
      		else { 
      		NPCatalogCategory c = new NPCatalogCategory(Convert.ToInt32(Request.QueryString["CategoryID"])); categoryName.Text = c.CategoryName; categoryName.Visible = true; 
      		}
      }
      %>
      <asp:Label ID="categoryName" CssClass="categoryHeader" runat="server" visible="false" />
      

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 10:17 PM

    I'm sorry if my questions are really lame, but though I'm a decent programmer in multiple other languages, I'm having to learn both ASP and Webtools at the same time, so I don't always know if my problem is just simple programming misunderstandings or if it is how Netpoint implemented something.

    I made a test plugin, put it in the banner slot, copied in the includes from another plugin, then pasted in your sample code (see below). It doesn't seem to be returning anything, but I can't figure out why. What am I doing wrong?

    <%@ Register TagPrefix="NP" Namespace="NetPoint.WebControls" Assembly="NetPoint.WebControls" %>
    <%@ Control Language="c#"%>
    <%@ Import Namespace="netpoint.classes" %>
    <%@ Import Namespace="netpoint.api.catalog" %>
    
    <%
    {
    		if ((Request.QueryString["ParentID"]) != null){
    		NPCatalogCategory pc = new NPCatalogCategory(Convert.ToInt32(Request.QueryString["ParentID"]));
    		categoryName.Text = pc.CategoryName; categoryName.Visible = true;
    		}
    		else if ((Request.QueryString["CategoryID"]) == null || (Request.QueryString["CategoryID"]) == ""){
    		categoryName.Text = @"";
    		}
    		else {
    		NPCatalogCategory c = new NPCatalogCategory(Convert.ToInt32(Request.QueryString["CategoryID"])); categoryName.Text = c.CategoryName; categoryName.Visible = true;
    		}
    }
    %>
    <asp:Label ID="categoryName" CssClass="categoryHeader" runat="server" visible="false" />

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Derek,

      Plugins must be an .ASCX file in the PLUGINS directory which you can find under your B1Webtools folder. Once your ASCX file is in the PLUGINS direcotry, you will be able to add a new slot to your theme. Choose slot type PLUGIN and you will see all of the plugins in the drop down below. Select your plugin and it will display on your theme.

      There is no embedding necessary. It is not necessary to edit the master page or any ASPX files. The system is created to display plugins in whatever slot you would like (banner, left, right, main, base...)

      If you see the name of the plugin in plain text on your theme, that means there is something programatically wrong with the code.

      To debug a plugin, I usually use an ASPX file called webform1.aspx located in your plugins directory. In the header of this file you can point to your ASCX plugin. Then in your browser type http://localhost/b1webtools/plugins/webform1.aspx

      This will allow you to see any program errors.

      I hope this helps.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.