|
-
April 6th, 2011, 02:51 AM
#1
Ajax UpdatePanel
Hi guys, how do i use AJAX updatePanel from default.aspx to display information from other aspx pages(e.g. default1.aspx) when i click on a button in default.aspx ? or is there any other ways so that i can achieve that ? examples on how to do it are greatly appreciated ...
-
April 7th, 2011, 03:07 AM
#2
Re: Ajax UpdatePanel
Make the content from other pages into a UserControl instead of a full page.
That should make it easier to place within your update panel.
UserControls are good when you want to reuse the content in more than one page.
-
April 11th, 2011, 12:43 AM
#3
Re: Ajax UpdatePanel
In general when developing a Web App, I personally create only one Main .ASPX page, and generate all the others needed as user control (.ASCX) pages..
Of course this requires you to switch in and out the controls depending on the page parameters passed, however once you get the hang of it it's relatively easy ..
Some sample code
MAIN.ASPX Designer
Code:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Main.aspx.vb" Inherits="Forums.Main" %>
<%@ Register src="Header.ascx" tagname="Header" tagprefix="uc1" %>
<%@ Register src="Catalogs.ascx" tagname="Catalogs" tagprefix="uc2" %>
<%@ Register src="Topics.ascx" tagname="Topics" tagprefix="uc4" %>
<%@ Register src="Posts.ascx" tagname="Posts" tagprefix="uc5" %>
<%@ Register src="NewPost.ascx" tagname="NewPost" tagprefix="uc6" %>
<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc3" %>
<asp:Panel Width="100%">
<uc1:Header ID="Header1" runat="server" />
<uc2:Catalogs ID="Catalogs1" runat="server" />
<uc4:Topics ID="Topics1" runat="server" />
<uc5:Posts ID="Posts1" runat="server" />
<uc6:NewPost ID="NewPost1" runat="server" />
<uc3:Footer ID="Footer1" runat="server" />
</asp:Panel>
And then in the Code
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
UserAgent = Request.ServerVariables("http_user_agent")
'get last IP
LastIp = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If Not LastIp Is Nothing Then
FIps = Split(LastIp, ",", -1, CompareMethod.Text)
LastIp = FIps(FIps.Length - 1)
Else
LastIp = Request.ServerVariables("REMOTE_ADDR")
End If
If Not IsPostBack Then
If Request.QueryString("Cat") IsNot Nothing Then
Catalogs1.Visible = True
ElseIf Request.QueryString("Group") IsNot Nothing Then
Catalogs1.Visible = True
ElseIf Request.QueryString("Do") IsNot Nothing Then
NewPost1.Visible = True
Footer1.Visible = False
ElseIf Request.QueryString("Forum") IsNot Nothing Then
Topics1.Visible = True
ElseIf Request.QueryString("Topic") IsNot Nothing Then
Posts1.Visible = True
Footer1.Visible = False
ElseIf Request.QueryString("Reply") IsNot Nothing Then
Posts1.Visible = True
Footer1.Visible = False
Else
Catalogs1.Visible = True
End If
End If
End Sub
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|