?
Solved

Get Page To Display At Anchor After a PostBack

Posted on 2004-03-24
3
Medium Priority
?
440 Views
Last Modified: 2010-08-05
Hi Experts,

My question is how do you get the page to
display at the anchor after a postback.

Specifically, when the linkbutton is
clicked in a lookup datagrid it should
direct the user to the anchor position after a postback.

I've found many articles on retaining scroll position
for datagrid, but this is not what I want.

Plz, take a look at my simple code and help
me figure this thing out.

As always, thanks for your replies !

<HTML>
  <HEAD>
    <TITLE>Test</TITLE>
    <LINK REL="stylesheet" HREF="div.css">
  </HEAD>
  <BODY leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
    <FORM id="TestForm" runat="server">
      <div id="Main">
        <asp:DataList ID="dtlTEst" Runat="server" Width="100%" BorderWidth="1" BorderColor="#006699">
          <HeaderTemplate>
            <table width="100%" cellspacing="0" cellpadding="0">
              <tr class="tablehead">
                <th align="left" width="10%">Detail</th>
                <th align="left" width="20%">Per ID</th>
                <th align="left" width="20%">Person</th>
              </tr>
          </HeaderTemplate>
          <ItemTemplate>
            <tr class="tablebody">
              <td><asp:LinkButton runat="server" id="lnkclaimid" Text="Details"  CommandName="SelectPer"
                   CommandArgument='<%# DataBinder.Eval(Container.DataItem, "perid") + ";" + DataBinder.Eval(Container.DataItem, "firstname") %>'
                   TOOLTIP="Click Here For Details" ></asp:LinkButton></td>
              <td><%# DataBinder.Eval(Container.DataItem, "perid") %></td>
              <td><%# DataBinder.Eval(Container.DataItem, "firstname") %></td>
            </tr>
          </ItemTemplate>
          <AlternatingItemTemplate>
            <tr class="alttablebody">
              <td><asp:LinkButton runat="server" id="Linkbutton1" Text="Details"  CommandName="SelectClaim"
                   CommandArgument='<%# DataBinder.Eval(Container.DataItem, "claimid") + ";" + DataBinder.Eval(Container.DataItem, "encounterline") %>'
                   TOOLTIP="Click Here For Details"  ></asp:LinkButton></td>
              <td><%# DataBinder.Eval(Container.DataItem, "perid") %></td>
              <td><%# DataBinder.Eval(Container.DataItem, "firstname") %></td>
            </tr>
          </AlternatingItemTemplate>
          <FooterTemplate>
            </table>
          </FooterTemplate>
        </asp:DataList>  
       
        <br><br><br><br><br><br><br><br>
        <asp:Panel ID="PnlEnd">

          <a name="#lblEnd"></a>
          <asp:Label ID="lblEnd" Runat=server></asp:Label>        
    </FORM>
    </DIV>
  </BODY>
</HTML>

Code-Behind When linkbutton is clicked:
  Private Sub dtlEncounters_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dtlEncounters.ItemCommand

    lblEnd.Text = "You're reached the end- testing"
  End Sub
0
Comment
Question by:allanau20
[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
  • 2
3 Comments
 
LVL 5

Author Comment

by:allanau20
ID: 10673467
0
 
LVL 6

Accepted Solution

by:
KarunSK earned 2000 total points
ID: 10673486
0
 
LVL 5

Author Comment

by:allanau20
ID: 10673536
Eureka(?) KarunSk !

It works great.

Thanks, and have a good nite !
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 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