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
Solved

Get Page To Display At Anchor After a PostBack

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

829 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