Solved

Get Page To Display At Anchor After a PostBack

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

16 Experts available now in Live!

Get 1:1 Help Now