Sorry for the obvious lack of details. I am using VB.NET and declaring a
simple string variable named "quickAdd".
------------------------------------
Partial Class Controls_User_PCSavedSearches
Inherits System.Web.UI.UserControl
Public quickAdd
End Sub
----------------------------------------
The User control that belongs to the code-behind class is added to the main
ASPX page.
------------------------------------------
<%@ Page Language="VB" MasterPageFile="~/SearchPage.master"
AutoEventWireup="false" EnableSessionState="True"
CodeFile="chooseSearch.aspx.vb" Inherits="Search_chooseSearch" title="Saved
Search Criteria" %>
<%@ MasterType VirtualPath="~/SearchPage.master" %>
<%@ Register Src="../Controls/User/PCSavedSearches.ascx"
TagName="PCSavedSearches"
TagPrefix="uc2" %>
<%@ Register Src="../Controls/User/CreateQuickSearchBar.ascx"
TagName="CreateQuickSearchBar"
TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content1" Runat="Server">
<% If Not quickadd = "Y" Then%>
<uc1:CreateQuickSearchBar ID="CreateQuickSearchBar1" runat="server" />
<% End If%>
<uc2:PCSavedSearches ID="PCSavedSearches1" runat="server" />
<input type="hidden" name="txtDeckName" id="txtDeckName"
value="<%=strDeckName %>" />
</asp:Content>
--------------------------------------------
I make reference to the variable and of course the compiler tells me it is
not declared, even though the Control is registered and is part of the ASPX
page. I guess I was wrong in thinking that if a simple string variable is
declared Public, even within a class, that it might be viewable outside the
class. I am wondering if I create a Public Property named QuickAdd and feed
it the contents of the variable quickAdd that I can do something like...
<% If Not Controls_User_PCSavedSearches.QuickAdd = "Y" Then%>
But I would most likely need to instantiate the class before referring to
it.
Sorry to bother you all with such trivial stuff.
"quickAdd" is public, but it's not "Global". It's still a property of the
User Control, so you must reference it through the User Control. Try this:
<% If Not PCSavedSearches1.quickAdd = "Y" Then %>
Also note that you have the property declared as "quickAdd" but you are
referencing "quickadd". I'm not familiar with VB, but in C# property names
are case-sensitive.
> Sorry for the obvious lack of details. I am using VB.NET and declaring a
> simple string variable named "quickAdd".
[quoted text clipped - 81 lines]
>>>
>>> Thanks...
John Kotuby - 12 Dec 2007 22:30 GMT
Thanks Scott,
You have been really helpful and thanks for not torching me on a such a
fundamental question.
VB allows for case insensitivity, but it is always good practice to practice
using proper case, as I am sometimes forced into writing Javascript routines
to attain a certain result. I am getting the sense that VB.NET will soon be
a thing of the past...even with assurances for Microsoft that it will
continue support.
> "quickAdd" is public, but it's not "Global". It's still a property of the
> User Control, so you must reference it through the User Control. Try this:
[quoted text clipped - 92 lines]
>>>>
>>>> Thanks...