Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Server.Transfer and "Error executing child request for..." error.

Posted on 2004-09-14
8
Medium Priority
?
4,499 Views
Last Modified: 2008-02-07
In my web page I have an HTML anchor tag that acts as a bookmark:

<A name="bookmark"></A>

When a command button on the page is clicked, I do a postback. If certain conditions exist, then I want to jump to the above bookmark. I use a line of code that looks like this:

Server.Transfer("#bookmark")

This generates the following error on the Server.Transfer line:

"Error executing child request for #bookmark."

How do I make my code jump to this bookmark?
0
Comment
Question by:rgrimm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12060701
I am using Javascript to do that. Here is an example..

    Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
        Dim stscript As String = "<script language=JavaScript>self.scrollTo(0,812);</script>"
        If (Not Page.IsStartupScriptRegistered("clientScript")) Then
            Page.RegisterStartupScript("clientScript", stscript)
        End If
    End Sub

-Baan
0
 

Author Comment

by:rgrimm
ID: 12060881
The JavaScript scrollTo method takes two arguments: xPosition and yPosition. It moves you to a specified x,y coordinate (origin is the top-left corner of the window) on the page. I need to go to a specific anchor tag.
0
 
LVL 6

Expert Comment

by:zulu_11
ID: 12063399
use response.redirect("Page.aspx?#bookmark")

zulu
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12063578
That will cause a postback...  I was trying to avoid a post back.
0
 

Author Comment

by:rgrimm
ID: 12065769
I tried using both of the following:

Server.Transfer("Page.aspx?#Bookmark")
Response.Redirect("Page.aspx?#Bookmark")

Both cause a fresh, blank page to reload, which I don't want. I need a postback that maintains the page state.
0
 

Author Comment

by:rgrimm
ID: 12109154
Here is the solution. It works great. Many thanks to Keem. See the link at the bottom for the entire discussion thread.

In VB.NET Create a method something like this...

Private Sub MoveToAnchor(ByVal anchorName As String)
  'Returns page to the given anchor
  Page.RegisterStartupScript("MoveToAnchor", "<script language=JavaScript>document.location.hash = '" & anchorName & "'</script>")
End Sub

Then if you have an anchor

<a name="Bookmark"></a>

In the VB.NET code just change your code to

If repSearchResults.Items.Count > 0 Then 'If repeater control has records, show panel, hide buttons
  pnlDuplicate.Visible = True
  cmdUpdate.Visible = False
  cmdCancel.Visible = False
  MoveToAnchor("Bookmark")
End If

( i'm guessing here that you are posting back to the same page, other wise you'd do do a Server.Transfer to the required page and then the call the MoveToAnchor )

********************************************************
http://www.gotdotnet.com/Community/MessageBoard/Thread.aspx?id=263244&Page=1#264260 
 
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12151580
Closed, 500 points refunded.
modname
Community Support Moderator
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question