473,767 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Control Strange Problem

I created a very simple user control which contains lable and drag the
control to page

<%@ Page language="c#" Codebehind="Val idate.aspx.cs" AutoEventWireup ="false"
Inherits="Learn ing.Validate" %>
<%@ Register TagPrefix="uc1" TagName="GroupF ilesManager"
Src="GroupFiles Manager.ascx" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Validate </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<uc1:GroupFiles Manager id="oGroupFiles Manager"
runat="server"> </uc1:GroupFilesM anager></form>
</body>
</HTML>

in cs file i define the control object as GroupFileManage r oGroupFilesMana ger;
but when try to use a function in
oGroupFilesMana ger it null??? why
Nov 19 '05 #1
3 1088
Hi Raed Sawalha,

Try to declare it as protected member:
protected GroupFileManage r oGroupFilesMana ger;

Raymond

"Raed Sawalha" wrote:
I created a very simple user control which contains lable and drag the
control to page

<%@ Page language="c#" Codebehind="Val idate.aspx.cs" AutoEventWireup ="false"
Inherits="Learn ing.Validate" %>
<%@ Register TagPrefix="uc1" TagName="GroupF ilesManager"
Src="GroupFiles Manager.ascx" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Validate </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<uc1:GroupFiles Manager id="oGroupFiles Manager"
runat="server"> </uc1:GroupFilesM anager></form>
</body>
</HTML>

in cs file i define the control object as GroupFileManage r oGroupFilesMana ger;
but when try to use a function in
oGroupFilesMana ger it null??? why

Nov 19 '05 #2
Great! it worked well....but what is the reason that I need to declare it as
protected?

"Raymond Yuen" wrote:
Hi Raed Sawalha,

Try to declare it as protected member:
protected GroupFileManage r oGroupFilesMana ger;

Raymond

"Raed Sawalha" wrote:
I created a very simple user control which contains lable and drag the
control to page

<%@ Page language="c#" Codebehind="Val idate.aspx.cs" AutoEventWireup ="false"
Inherits="Learn ing.Validate" %>
<%@ Register TagPrefix="uc1" TagName="GroupF ilesManager"
Src="GroupFiles Manager.ascx" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Validate </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<uc1:GroupFiles Manager id="oGroupFiles Manager"
runat="server"> </uc1:GroupFilesM anager></form>
</body>
</HTML>

in cs file i define the control object as GroupFileManage r oGroupFilesMana ger;
but when try to use a function in
oGroupFilesMana ger it null??? why

Nov 19 '05 #3
If you declare it as "protected" member, then the ASP.NET runtime will "know"
that the control declared on your WebForm is inherited from the object
declared in its code-behind page. Otherwise, the object declared in the
code-behind will be an independent object.

Raymond

"Raed Sawalha" wrote:
Great! it worked well....but what is the reason that I need to declare it as
protected?

"Raymond Yuen" wrote:
Hi Raed Sawalha,

Try to declare it as protected member:
protected GroupFileManage r oGroupFilesMana ger;

Raymond

"Raed Sawalha" wrote:
I created a very simple user control which contains lable and drag the
control to page

<%@ Page language="c#" Codebehind="Val idate.aspx.cs" AutoEventWireup ="false"
Inherits="Learn ing.Validate" %>
<%@ Register TagPrefix="uc1" TagName="GroupF ilesManager"
Src="GroupFiles Manager.ascx" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Validate </title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="C#" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<uc1:GroupFiles Manager id="oGroupFiles Manager"
runat="server"> </uc1:GroupFilesM anager></form>
</body>
</HTML>

in cs file i define the control object as GroupFileManage r oGroupFilesMana ger;
but when try to use a function in
oGroupFilesMana ger it null??? why

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2704
by: BBM | last post by:
Hi, I have been developing with C# User Controls and occasionally have a problem where I "lose" a control from the design surface of the User Control. The controls that I am using to build my User Controls are themselves custom controls. Occasionally, when I change something in either the User Control and/or one of the custom controls that are on it and recompile, when I go to the "Visual" design surface of the User Control, the...
1
7587
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
0
3936
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a bug.
5
1999
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a bug.
4
4478
by: Joseph Geretz | last post by:
Don't get me wrong - I'm a fan of .NET; I am enthusiastic about the richness and elegance of the environment. However, richness and elegance should be dedicated toward making development easier for developers, not more difficult. In many ways this goal is achieved. However, I've run up against one particular area of development, where what should be a trivial excercise is turning out to be much more difficult than it should be. I'm trying...
0
10169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7383
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.