473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Interaction with UserControls (ascx)?

Hi NG,

I have 2 problems working with an user control (ascx) and couldn't find
a solution yet.
I created a simple ascx with some ImageButtons and drag it on a simple
Webform, this code was inserted:

<%@ Register TagPrefix="uc1" TagName="chunk_container"
Src="chunk_container/chunk_container.ascx" %>

and in the body-tag:

<uc1:chunk_container id="Chunk_container1"
runat="server"></uc1:chunk_container>

1.) the Page_Load function of the ascx isn't execuded. It seems that the
ascx doesn't receive the event

2.) as shown above, an instance of my UserControl is created within the
body-tag, but I do not have any reference in my code behind. I'd expect
something like
protected Namespace.chunk_container Chunk_container1;

but there ain't such declaration. So I cannot access the functions, that
are public in my UserControl (and essential for the use of it).

I'm afraid, that I am completely out of line and hope, someone here can
give me a clue, how to solve this problems.

Thanks in advance,
Frank

PS: I am using VS.NET 2003, C#, W2003
Nov 18 '05 #1
4 1680
Frank Schumacher wrote:
1.) the Page_Load function of the ascx isn't execuded. It seems that the
ascx doesn't receive the event
What does your @Control tag in the User Control look like?

2.) as shown above, an instance of my UserControl is created within the
body-tag, but I do not have any reference in my code behind. I'd expect
something like
protected Namespace.chunk_container Chunk_container1;


Sadly, you have to add that manually. :-/

Also, might I suggest that you check out my article:

An Extensive Examination of User Controls
http://tinyurl.com/6nddj

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
Check out this article for Interactive Event Driven ASP.NET User Controls
http://www.mastercsharp.com/article....=67&&TopicID=2

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Frank Schumacher" <fs*******@informatik.uni-leipzig.de> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
Hi NG,

I have 2 problems working with an user control (ascx) and couldn't find
a solution yet.
I created a simple ascx with some ImageButtons and drag it on a simple
Webform, this code was inserted:

<%@ Register TagPrefix="uc1" TagName="chunk_container"
Src="chunk_container/chunk_container.ascx" %>

and in the body-tag:

<uc1:chunk_container id="Chunk_container1"
runat="server"></uc1:chunk_container>

1.) the Page_Load function of the ascx isn't execuded. It seems that the
ascx doesn't receive the event

2.) as shown above, an instance of my UserControl is created within the
body-tag, but I do not have any reference in my code behind. I'd expect
something like
protected Namespace.chunk_container Chunk_container1;

but there ain't such declaration. So I cannot access the functions, that
are public in my UserControl (and essential for the use of it).

I'm afraid, that I am completely out of line and hope, someone here can
give me a clue, how to solve this problems.

Thanks in advance,
Frank

PS: I am using VS.NET 2003, C#, W2003

Nov 18 '05 #3
Hallo Scott

Scott Mitchell [MVP] wrote:
Frank Schumacher wrote:
1.) the Page_Load function of the ascx isn't execuded. It seems that
the ascx doesn't receive the event

What does your @Control tag in the User Control look like?


I have checked the statement and found an "AutoEventWireUp" Attribut
which was set to false. After changing it to true, the user control got
its events.

2.) as shown above, an instance of my UserControl is created within
the body-tag, but I do not have any reference in my code behind. I'd
expect something like
protected Namespace.chunk_container Chunk_container1;

Sadly, you have to add that manually. :-/


As long as I know that I have to add it manually, it is no problem. Now
I know it, so no problem anymore .. :)

Also, might I suggest that you check out my article:

An Extensive Examination of User Controls
http://tinyurl.com/6nddj
I have done it and found some answers, even on questions that might be
arise in the future ...

Happy Programming!


It became a bit happier now .. thanks for the input!

Frank
Nov 18 '05 #4
Hi Saravana,

thanks for the link! It wasn't exactly what I was looking for, but
interesting anyway. I just don't understand, why the author mourned
about not being able to use inline server scripting. Why would anyone
use inlining now that we have code behind?

Ciao,
Frank

Saravana wrote:
Check out this article for Interactive Event Driven ASP.NET User Controls
http://www.mastercsharp.com/article....=67&&TopicID=2

Nov 18 '05 #5

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

Similar topics

1
by: wh | last post by:
After spent a good half day looking for a solution I'm no further finding an answer so I'd appreciate any ideas as to how this can be done. I have developed a user control that resides in a .ascx...
4
by: Anders K. Jacobsen [DK] | last post by:
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on solution file with aprox 10 projects. 2 of these is...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
1
by: Andrew Mercer | last post by:
Hi, I am new to ASP having previously been doing Java. I think User Controls are good but I have problem that I cannot solve - spent a long time searching the web without so far much...
0
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender,...
1
by: Carlo Razzeto | last post by:
Hey, I've got a couple of production UserControls going in my companies web system, but I'm having a couple of annoying issues with them. One of them, for instance is a ScannerButton control which...
5
by: Nathan Sokalski | last post by:
My Web.config file contains the following section to register some of my UserControls: <pages> <controls> <add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/> <add tagPrefix="NATE"...
0
by: Nathan Sokalski | last post by:
I have several UserControls (*.ascx files) that I register in my Web.config file under the <system.web><pages><controlselement. If I mistype the src attribute in the Web.config file, the pages that...
7
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.