Problem calling Function/method (ASP.NET C#)

I am having a problem accessing a method I defined.  I am new to ASP.NET C#.

I added a new snipplet called SerializeNodes()  to a C# file name SQLWhereBuilder.cs.    I am trying to call this snipplet from another program called Test.aspx.cs but I get an error saying it is not found.  My syntax is  String s = this.swb1.SerializeNodes();  I provided the code from the two programs below.  My questions:

1.  after adding the code to the SQLWhereBuilder.cs program do I need to do something else like build a new .dll file?
2.  after adding the code to the SQLWhereBuilder.cs program do I need to do something else to make these methods?
3.  why can I not call this function?


Program: SQLWhereBuilder.cs
  namespace UNLV.IAP.WebControls
  {
      public class SqlWhereBuilder : System.Web.UI.Control, IPostBackDataHandler
      {
          public string SerializeNodes()    
             {
                some code....                    
             {
       }
  }


Program:Test.aspx.cs

  using UNLV.IAP.WebControls;

  namespace swbWeb
  {      
      public partial class SqlNorthwind : System.Web.UI.Page
    {      
            public void Page_Load(object sender, System.EventArgs e)
          {
                        String s = this.swb1.SerializeNodes();
                  }
     }
  }
HojoformoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
How is swb1 declared?

Bob
HojoformoAuthor Commented:
decalred in the Test.aspx program as follows:

<P><cc1:sqlwherebuilder id="swb1" runat="server" FieldsFile="Configuration/SqlNorthwind/fields.config" OperatorListsFile="Configuration/SqlNorthwind/operatorLists.config" ValueEntryFile="Configuration/SqlNorthwind/valueEntryDivs.config" NoConditionsText="No conditions specified" ButtonStyle="font-size: 10pt;" MainStyle="border: 2x solid lightBlue;" ConditionCellStyle="border: 1px solid lightBlue; padding:2px; background-color: #F0F8FF" EditButtonsHiliteColor="lightBlue" EditButtonsStyle="font-family: 'Tahoma'; font-size: 12pt; cursor:pointer; "ConditionDisplayStyle="font-family: 'Tahoma'; font-size: 10pt; padding: 2px;"></cc1:sqlwherebuilder></P>
HojoformoAuthor Commented:
here is the tag for cc1 :

<%@ Register TagPrefix="cc1" Namespace="UNLV.IAP.WebControls" Assembly="SqlWhereBuilder" %>
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Bob LearnedCommented:
I don't see a runat="server" attribute.

Bob
HojoformoAuthor Commented:
it's there <P><cc1:sqlwherebuilder id="swb1" runat="server"......
HojoformoAuthor Commented:
the error i get is
Error      2      'UNLV.IAP.WebControls.SqlWhereBuilder' does not contain a definition for 'SerializeNodes'      38      C:\Inetpub\wwwroot\aspnet_client\SqlNorthwind.aspx.cs      64      C:\...\aspnet_client\
Bob LearnedCommented:
Was this a typo?

   String s = this.swb1.SerializeNodes();

should be:
 
  string s = this.swb1.SerializeNodes();

I don't believe that it is case sensitive, but I use VB.NET with my ASP.NET pages.  You have this:

cc1:sqlwherebuilder

   and not

cc1:SqlWhereBuilder

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
teeg01Commented:
You may want to try Remove Reference for the UNLV.IAP.WebControls.SqlWhereBuilder.dll and re-Add the Referenece to the Project.
alpesh_mcaCommented:
Hi Hojoformo,

As per my experience SQLWhereBuilder.cs page directives as below:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="SQLWhereBuilder.cs" Inherits="UNLV.IAP.WebControls.SQLWhereBuilder" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

write :      [DesignTimeVisible(true)] before
 public class SqlWhereBuilder : System.Web.UI.Control, IPostBackDataHandler

then we you write below code it will work.
String s = this.swb1.SerializeNodes();
To get more knowledge regarding User Control refer following links:
http://aspnet.4guysfromrolla.com/articles/031704-1.aspx

I hope this is what you are looking for.
All the very best.
Thanks.
Alpesh Patel.






It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.