Solved

Get Page To Display At Anchor After a PostBack

Posted on 2004-03-24
3
433 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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 …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now