Solved

Get Page To Display At Anchor After a PostBack

Posted on 2004-03-24
3
436 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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