473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master / ContentTemplate / UpdatePanel / UserControl

22 New Member
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.con tenttemplate. But cant do it this way for user control 2!

Thanks in advance.

Tim
Feb 7 '09 #1
9 7466
amirghaffarie1362
19 New Member
search about interface layer in asp.net in google ,
Feb 9 '09 #2
TimVtoo
22 New Member
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 New Member
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 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Moderator Expert
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 New Member
OK, I'll try to explain...
I have a master page with 2 ContentPlaceHol ders. 1 of these ContentPlaceHol ders 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 contentplacehol der).

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 ContentPlaceHol der, 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 Recognized Expert Moderator Expert
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 New Member
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
6228
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? I'm basically trying to set it up so that I can keep the User infor (userid, ect) in the Masterpage so that other pages can access it. Thanks for any ideas. Michael
5
3477
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 menu. When i click on this button it rises a postback and refresh all my controls. My question is the following : is it possible the postback acts only on one web control ? Thanks in advance
4
3919
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 these two things, the page flashes everytime my textbox changes and the panel is updated. If I just use a regular textbox along with the Master Page, it works fine. If I use by user control without the Master Pages, it works fine. When I...
1
1207
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 EnablePartialRendering="true" ID="ScriptManager" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" Visible="true"> <ContentTemplate>
0
1042
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 clicks a ButtonLink in the aspx page I want it to trigger the button OnClick on the master page. I have tried the following;
1
3400
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 button ... I get the following message : A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in...
4
1740
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 master page: <body> <form id="Main" method="post" runat="server"> <div class="Header"></div> <asp:ScriptManager ID="ScriptManager1" runat="server"></ asp:ScriptManager>
5
12604
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 to the updatepanel, but the problem is, I have an update panel inside a web usercontrol, and the usercontrol is sitting inside an updatepanel on the host page. I therefore can't add a trigger to the control directly, as the host page has no access...
10
2141
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 Master pages as their master...) the entire page is refreshed - also the menu which belongs to the master, how can I fix it - so only the inside content will be refreshed ?
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9263
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8210
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
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
4570
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
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.