Hello,
I use a template whereby my default page contains various user controls -
i.e. "Header", "Footer", "Navigation", "Content".
On some occaisions I'd like to manipulate the other controls from the
content control, without refreshing the default page. Currently, to change
the content I refresh the default page by doing a response.redirect and
referencing the new content page in the querystring. My default page
includes the following in its postback:
Dim p As String
p = Request.QueryString("Page")
If p = "" Then
With phContent
..Controls.Clear()
..Controls.Add(LoadControl("Home.ascx"))
End With
Else
With phContent
..Controls.Clear()
..Controls.Add(LoadControl("~/Protected/" & p & ".ascx"))
End With
End If
Is their an easier way to do this without having to refresh the aspx page,
for instane content changes header, or navigation updates footer, etc.?
Thanks in advance,
bw 5 1300
Hi Draneb:
Take a look at script callbacks towards the bottom of this article: http://msdn.microsoft.com/msdnmag/is...8/CuttingEdge/
HTH,
--
Scott http://www.OdeToCode.com/blogs/scott/
On Sat, 23 Apr 2005 20:07:13 GMT, "Dranreb"
<bw*********@houston.rr.com> wrote: Hello,
I use a template whereby my default page contains various user controls - i.e. "Header", "Footer", "Navigation", "Content".
On some occaisions I'd like to manipulate the other controls from the content control, without refreshing the default page. Currently, to change the content I refresh the default page by doing a response.redirect and referencing the new content page in the querystring. My default page includes the following in its postback: Dim p As String
p = Request.QueryString("Page")
If p = "" Then
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("Home.ascx"))
End With
Else
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("~/Protected/" & p & ".ascx"))
End With
End If
Is their an easier way to do this without having to refresh the aspx page, for instane content changes header, or navigation updates footer, etc.?
Thanks in advance,
bw
I'm not entirely clear on your situation. However, it seems to me that
your problem might be solved simply by defining some custom events on
your user controls. For example, you could have an event fire every
time control A was changed in some way. This event would be trapped
and handled on the page and would cause properties to be set or methods
to be called in controls B, C, D, etc.
For example, in user control A:
'Declare the event
Public Event SomethingChanged (ByVal obj As Object, ByVal e As
EventArgs)
'Raise the event inside a property or method in the control
RaiseEvent SomethingChanged (EventArgs.Empty)
Inside the page, trap the event and do something to the other controls
as a result
Sub ControlAChanged (obj as Object, e as EventArgs) handles
controla.SomethingChanged
'set properties or do something to other controls in the page
End Sub
Using events should allow you to coordinate the controls within the
page without resorting to Response.Redirect. Of course, this still
happens within the context of a postback. If you want controls to be
changed without any postback, you'll need to do that on the client side
with javascript.
Bill E.
Thanks Scott. I'll give it a try and let you know how well it works.
Thanks again
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:m2********************************@4ax.com... Hi Draneb:
Take a look at script callbacks towards the bottom of this article: http://msdn.microsoft.com/msdnmag/is...8/CuttingEdge/
HTH,
-- Scott http://www.OdeToCode.com/blogs/scott/
On Sat, 23 Apr 2005 20:07:13 GMT, "Dranreb" <bw*********@houston.rr.com> wrote:
Hello,
I use a template whereby my default page contains various user controls - i.e. "Header", "Footer", "Navigation", "Content".
On some occaisions I'd like to manipulate the other controls from the content control, without refreshing the default page. Currently, to change the content I refresh the default page by doing a response.redirect and referencing the new content page in the querystring. My default page includes the following in its postback: Dim p As String
p = Request.QueryString("Page")
If p = "" Then
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("Home.ascx"))
End With
Else
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("~/Protected/" & p & ".ascx"))
End With
End If
Is their an easier way to do this without having to refresh the aspx page, for instane content changes header, or navigation updates footer, etc.?
Thanks in advance,
bw
I'll try it but it appears that I would be updating controls on the existing
acsx page. What I want is to change the controls on another acsx page
without affecting the aspx page at all.
Thanks, I'll let you know how it works out.
<bi********@netscape.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... I'm not entirely clear on your situation. However, it seems to me that your problem might be solved simply by defining some custom events on your user controls. For example, you could have an event fire every time control A was changed in some way. This event would be trapped and handled on the page and would cause properties to be set or methods to be called in controls B, C, D, etc.
For example, in user control A:
'Declare the event Public Event SomethingChanged (ByVal obj As Object, ByVal e As EventArgs)
'Raise the event inside a property or method in the control RaiseEvent SomethingChanged (EventArgs.Empty)
Inside the page, trap the event and do something to the other controls as a result
Sub ControlAChanged (obj as Object, e as EventArgs) handles controla.SomethingChanged 'set properties or do something to other controls in the page End Sub
Using events should allow you to coordinate the controls within the page without resorting to Response.Redirect. Of course, this still happens within the context of a postback. If you want controls to be changed without any postback, you'll need to do that on the client side with javascript.
Bill E.
Resolved the issue. Here's how:
Even during the problem I could always find the PlaceHolderControl -
"phHeader" on the Page object. Once I found it, I just traversed every
control it contained until I came accross the controls, in this case labels,
I was searching for.
Code:
================================================== =========================
================================================== =========================
Dim ph As PlaceHolder = Page.FindControl("aiHeader")
Dim c As Control
For Each c In ph.Controls
If TypeOf c Is aiHeader Then
Dim cLabel As Label
cLabel = c.FindControl("lblProjectName")
cLabel.Text = sProject
Session("ProjectName") = cLabel.Text
Dim sUser As Label
sUser = c.FindControl("lblUserName")
sUser.Text = Page.User.Identity.Name
End If
Next
================================================== ==================================================
================================================== ==================================================
This works for me. I'm not sure what kind of perfomance hit I take, but this
isn't a high volume site anyway.
Thanks for your suggestions.
"Dranreb" <bw*********@houston.rr.com> wrote in message
news:RV******************@tornado.texas.rr.com... Hello,
I use a template whereby my default page contains various user controls - i.e. "Header", "Footer", "Navigation", "Content".
On some occaisions I'd like to manipulate the other controls from the content control, without refreshing the default page. Currently, to change the content I refresh the default page by doing a response.redirect and referencing the new content page in the querystring. My default page includes the following in its postback: Dim p As String
p = Request.QueryString("Page")
If p = "" Then
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("Home.ascx"))
End With
Else
With phContent
.Controls.Clear()
.Controls.Add(LoadControl("~/Protected/" & p & ".ascx"))
End With
End If
Is their an easier way to do this without having to refresh the aspx page, for instane content changes header, or navigation updates footer, etc.?
Thanks in advance,
bw
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Johnny |
last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form
(fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip
code. The user can enter a zip code in the text box and...
|
by: Akira |
last post by:
Hello.
I'm having problem with passing parameters from .aspx file to user
control.
Could anyone tell me how to pass parameters from .aspx file to user
control(.ascx) and how to recieve parameters...
|
by: Josh |
last post by:
Hi Guys,
I have been having a big problem with trying to pass parameters into a
user control when the user control is dynamically loaded into a
placholder. I am developing in c#. I have get...
|
by: Richard Payne |
last post by:
Hi
I am after what is the best/simplest way to pass objects between Web User
Controls which doesn't use the session object.
Regards
Richard
|
by: Dranreb |
last post by:
Hello,
I use a template whereby my default page contains various user controls -
i.e. "Header", "Footer", "Navigation", "Content".
On some occaisions I'd like to manipulate the other controls...
|
by: voro.cibus |
last post by:
I have been reading up on this all day, and I can't find the answer (or
more likely, don't understand the answers I have found) to my problem.
I have a table that stores the name of my ascx page....
|
by: Deano |
last post by:
Apparently you can only do this with one value i.e Call
MyAssetLocationZoom(Me!txtLocation, "Amend data")
This runs;
Public Sub MyAssetLocationZoom(ctl As Control, formName As String)
On...
|
by: SteveDouglas |
last post by:
Hi all,
I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
|
by: John Sheppard |
last post by:
Hello there I was wondering if anyone could help me,
I am trying to pass a typed dataset to a dialoged child form by reference.
I have binding sources sitting on the child form. So to refresh...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: 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...
| |