[RESOLVED] Load another page without page refresh.

I have 2 pages (test1.aspx & test2.aspx). I have one button in test1.aspx, on click of it, I am loading test2.aspx, like Response.Redirect("test2.aspx"). It refreshes the browser/ page and load test2.aspx.

What I have to do is, I have to load test2.aspx without any page/ browser refresh.

 

 

Thanks,

Whenever any brand new page loads , it will refresh the browser.

You may develop  test2.aspx in a UserControl & load it in a UpdatePanel

That I know. I can use iframe too and can set the source of iFrame to test2.aspx, but I am looking for solution without iframe or UserControl.

 

Thanks, 

Not sure but i think ive done something like that with javascript before without it posting back the page

'Build a javascript alert
                'please note the peculiar '/script' in the last line of the script string
                'This is to work around the problem that compiler would mistake the
                'closing script tag as the outer script closing tag.
                Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
                sb.Append("<script language='javascript'>")
                sb.Append("window.open('alertsAgent.aspx?MU_ID=" & MU_IDstring.ToString & "&Site=" & SiteString.ToString & "&firstname=" & firstnameString.ToString & "&surname=" & surnameString.ToString & "&username=" & usernameString.ToString & "', 'Alerts', 'width=680,height=300,fullscreen=no,scrollbars=1,resizable=0,status=1,dependent=yes,alwaysRaised=yes');{ self.close() };<")
                sb.Append("/script>")


                'register with ClientScript


                Dim t As Type = Me.GetType
                If Not ClientScript.IsClientScriptBlockRegistered(t, "redirectAgentScript") Then
                    ClientScript.RegisterClientScriptBlock(t, "redirectAgentScript", sb.ToString)
                End If


 

You need to take advantage of ASP.NET Ajax partial page refreshing, or use iFrame inside your page to trigger the test2.spx inside your test1.aspx.

Or may be try using JQuery/JTemplate/JSON to load a page w/o flicker. 

Try like this...use HttpWebRequest class, get the html response and then make a jquery call to this function and try to replace the complete form with the html content which you get to jquery....

i never tried it....but there might be performance concerns, i dont know yet...but it might work...

PS - have you tried MultiView control...look at that may be it might fit your requirement...

Thanks.

function LoadPage() {
            window.location = "test2.aspx";
            return false;
        }


// call this function by button client clcik




 <asp:Button ID="btnClick" runat="server" OnClientClick="return LoadPage();" />


You can achieve this same things by javascript function with below code.

1 thoughts on "[RESOLVED] Load another page without page refresh."

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>