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: -
<MasterPage>
-
<UpdateTrigger/>
-
-
<ContentPlaceHolder 1>
-
< asynch UpdatePanel>
-
<UserControl 1/>
-
</ asynch UpdatePanel>
-
</ContentPlaceHolder>
-
-
<ContentPlaceHolder 2>
-
< asynch UpdatePanel>
-
*** <UserControl 2/> ***
-
</ asynch UpdatePanel>
-
</ContentPlaceHolder>
-
-
</MasterPage>
-
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
9 7466
search about interface layer in asp.net in google ,
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
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??
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.
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 ??
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
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
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.
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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...
|
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>
|
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;
| |
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...
|
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>
|
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...
|
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 ?
|
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,...
|
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,...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |