473,396 Members | 1,766 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,396 software developers and data experts.

Master / ContentTemplate / UpdatePanel / UserControl

22
asp VB.NET

How can I pass a value to my user controls in the example below From the Master Page?... it's driving me nuts!
The scenario:
Expand|Select|Wrap|Line Numbers
  1. <MasterPage>
  2. <UpdateTrigger/>
  3.  
  4. <ContentPlaceHolder 1>
  5.     < asynch  UpdatePanel>
  6.         <UserControl 1/>
  7.     </ asynch UpdatePanel>
  8. </ContentPlaceHolder>
  9.  
  10. <ContentPlaceHolder 2>
  11.     < asynch UpdatePanel>
  12.          *** <UserControl 2/> ***
  13.     </ asynch UpdatePanel>
  14. </ContentPlaceHolder>
  15.  
  16. </MasterPage>
  17.  
I have tried to illustrate my scenario above because I am rubish at explaining myself and the real code would be far to much to post, and is split across multiple pages....ie: master / content / user control ..etc.

I have managed to pass a value to user control 1 by creating it dynamicaly and setting an attribute for it before adding adding it to the updatepanel.contenttemplate. But cant do it this way for user control 2!

Thanks in advance.

Tim
Feb 7 '09 #1
9 7434
search about interface layer in asp.net in google ,
Feb 9 '09 #2
TimVtoo
22
I've spent all weekend and much of last week googling this one... I think Interface Layer is a bit of a broad subject for my specific question ??

I have worked around this now by doing away with the user control and just coding it in the update panel, but I would still like to know the answer if anyone can help ??

Thanks

Tim
Feb 9 '09 #3
TimVtoo
22
Some kind of response here would be good. Everytime I work around this problem it raises it's ugly head again.... it must be doable??

Pleeeaaase, someone throw me a bone??
Feb 10 '09 #4
Frinavale
9,735 Expert Mod 8TB
Ok, I'm not sure what the problem is.
You have a UserControl, it's much like a class, it has Properties and Public methods that can expose data to the parent container.

In this case the MasterPage is your parent container.

So if you add Properties and Public methods to your User Control, then your MasterPage will be able to access information provided by that control.
Feb 10 '09 #5
TimVtoo
22
Thanks Frin, but what about the UpdatePanel?...
I've tried everything (in my very limited arsenol), but just cant get info in or out of that usercontrol INSIDE the update panel ??
Feb 10 '09 #6
Frinavale
9,735 Expert Mod 8TB
I have no idea why you would have a problem with this.
I place User Controls in UpdatePanels all the time and have no problem accessing their properties in the parent page....and I don't Have to create them dynamically in order to do this either.

What have you tried to solve the problem?
Could you provide more details about what you are trying to access in the MasterPage and when you are trying to access that data?

Mind you I haven't really tried placing them directly in the master page....I use Content Pages, which contain the User Controls.

Let's see if we can't figure this out.

-Frinny
Feb 10 '09 #7
TimVtoo
22
OK, I'll try to explain...
I have a master page with 2 ContentPlaceHolders. 1 of these ContentPlaceHolders has a gridview. When you click an item in the gridview. Using javascript, this puts a value in a texbox in the master page and clickes a button which triggers the update panels (1 in each contentplaceholder).

I would like either:
the user controls in the update panels to access the value in the textbox on the master so they get thier results based on that value
OR
the button click (trigger) event to set a property for each user control so they can display result based on the property value.

As I understand it, to acees controls in a ContentPlaceHolder, I have to use the FindControl() method, but doing this does not expose the properties for the user control.... I hope that makes at least some sence??

Thanks again for your time!

Tim
Feb 10 '09 #8
Frinavale
9,735 Expert Mod 8TB
You are going to have to have both controls and the TextBox in the same UpdatePanel in order for them to be able to access it's value during asynchronous postback.

Do you have to use the MasterPage or could you place both of these UserControls into a Content Page?

I think it would be a lot easier if you used a content page.
Your UserControl that contains the GridView could raise an event when the button is clicked...which the content page could handle and update the second UserControl. Please note that both controls are still going to have to be in the same update panel.
Feb 10 '09 #9
TimVtoo
22
At the moment the Master page has 2 columns. 1 UpdatePanel/UserControl in each. I did try puting both UC's in 1 UdtPnl and repositioning 1 of the UC's using css position:fixed. What I learnt there was that CSS will only position the content of a placeholer within that place holder. If you try to position beyond that placholder (ie: over the right column from the left hand column) it just gets croped and wont display. Probably obvious to you experienced types!

I think tomorrow I will ditch the Master Page for this particular page and re-create it on it's own. That way I should be able to access my user controls properties directly right??

Am I right in thinking that the problems I'm having accessing my U'Control properties is because I'm having to use FindControl() to get around my Master/Content elements?

Sorry for sounding a bit of a muppet, but it's all new to me and it seems I've managed to cram a bad combination of tools and controls together on my first project causing me alot of confusion.... trying to run before I can walk I guess.

Thanks again Frinny
Feb 10 '09 #10

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

Similar topics

13
by: Michael | last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I would like to set that value from the UserControl, but I can't seem to find a way to do this. Does anyone have any ideas?...
5
by: Vincent A. | last post by:
Hello, I'm developping an asp.net application which used master page on which i add several web control. One of the them is a menu control which as several button in order to develop each sub...
4
by: Diane Yocom | last post by:
I'm trying to use an Atlas UpdatePanel to just update a label when a text box has changed. The problem is that my textbox is in a user control and I'm using Master Pages - with the combination of...
1
by: dschreiber | last post by:
Hello all, I'm using a master page whose body is set up like so: <body style="background-color: #aacbf8;"> <form id="form1" runat="server"> <asp:ScriptManager...
0
by: Proogeren | last post by:
Hello I have a problem I am using ajax and I have a aspx page that belongs to a master page. I am using the update panel on the aspx page and want to acheive the following When the user...
1
by: Yordan Georgiev | last post by:
I have a search form using master page , which is dynamically generated from the column names of the database - when the users have a search result it should be exported to Excel by clicking the...
4
by: scottingim | last post by:
I have set up a updateprogress on my master page. It contains a label, so I can give page-appropriate messages while updates are going on. However, I cannot update the label. Here is the...
5
by: Leon Mayne | last post by:
Having a bit of trouble here. I know that if you want to use a fileupload control inside an AJAX update panel then you need to create a trigger for the control that performs the uploading postback...
10
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, Trying to create a master page that holds a menu, and the menu switches between pages in the site. 2 problem arrosed: a. When I navigate from page to page (all AJAX Web Forms, with the...
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:
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
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?
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.