473,327 Members | 2,016 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,327 software developers and data experts.

Using ASCX controls

7
Hi All!

I am relatively new to aspx, and learning, here is a question for you, I hope anyone of you can answer me, appologies of it sound stupid to you :)

I have created a page and converted it into an asxc control, now I am adding this ascx control at some pages and its supposed to take some information out of session variables that are created on the parent aspx pages.

Now the problem part: I have a button on that page which when click, pass some data to session variable, and the page is reloaded, at the same time the ascx control is also loaded inside that, but the session variables are not assigned to that control as desired, they will come if i reload the page second time. A third reload to page will give 2nd time session data and so on, one less the i desire it to have.

What I get from this is, the ascx control's load event accomplishes first and then the parent aspx's load subroutine loads afterwards.

I need a solution to it, if someone can tell me how to invoke a sub or function of ascx control from parent aspx page, i can find answer to this problem or if there is any other better solution , i will love to learn that.....


Thanks to all in advance, and I hope I made you understand on my problem with my tricky english......:)

regards

Yasser Khan
Sep 8 '06 #1
2 5478
mykhan
7
I guess its not a very difficult question, or maybe it is.............Pls if some one have a clue, let me know, any suggestion is welcomed, good or bad ;)
Sep 11 '06 #2
If you override the init, preRender, Render events (type override[space] in C#, or use the dropdown in VB) then you can see when each event is happening in the control and the parent page by using Debug.WriteLine(...)

Do this and you will see something like:

controls_PupilDetailControl:init
Page:Init
Page:Load
controls_PupilDetailControl:load
Page:OnLoadComplete
Page:OnPreRender
controls_PupilDetailControl:OnPreRender
Page:Render
controls_PupilDetailControl:render

SO you can see if you are setting the values to display in your control in your init or load event then the values may not have been set by the parent by then.

So most likely the solution is to use a later event in the control.
Sep 18 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Peter Jackson | last post by:
I'm using v2 of the UIP App. Block. I've created all my .aspx pages, all of which contain .ascx user controls. The .ascx user controls provide the standard server controls (i.e., LinkButtons, etc.)...
1
by: Oleg Ogurok | last post by:
Hi all, In my page class, I'm loading a user control: private void Page_Load(object sender, System.EventArgs e) { Control c = LoadControl("WebUserControl1.ascx"); Controls.AddAt(0, c); }
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
5
by: djscratchnsniffing | last post by:
i know you can access an ascx's properties/methods from an aspx file. Let's say you have an aspx file with two code-behind files(ascx files). Can you access one of the ascx file's...
6
by: David Bowey | last post by:
Hi There! I have som reusable ASCX controls that I also want to let my clients use in their websites. However, I don't want them to "have" the ASCX controls on their web servers. Instead I would...
2
by: Steve Richter | last post by:
I like the idea of being able to place server controls in an assembly and use them in all of my web applications. On the other hand I like the ease of using an .ascx file when I write user...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
0
by: mschep | last post by:
Hi, I built an assembly with a set of user controls. This can be done with the Visual Studio 2005 Deployment Project: building and merging for example all your aspx and ascx in one dll (lets...
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"...
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.