Web Forms :: Dropdownlist Jump To Anchor On Same Page
Jan 26, 2010
so I'm trying to get this dropdown thing to work but it's not working... I want the page to jump to the state on the SAME page once the USER releases on the desired state within the dropdownlist box.
HTML
<asp:DropDownList ID="ddltest" runat="server">
<asp:ListItem value="AL"> Alabama </asp:ListItem>
<asp:ListItem value="AK"> Alaska </asp:ListItem>
<asp:ListItem value="AZ"> Arizona </asp:ListItem>
<asp:ListItem value="AR"> Arkansas </asp:ListItem>
<asp:ListItem value="CA"> California </asp:ListItem>
<asp:ListItem value="CO"> Colorado </asp:ListItem>
<asp:ListItem value="CT"> Connecticut </asp:ListItem>
</asp:DropDownList>
<!-- New State -->
<a name="WY" id="WY"></a>
<div>Wyoming</div>
CODE BEHIND
protected void Page_Load(object sender, EventArgs e)
{
ddltest.Attributes.Add("onchange", "window.location.href = path.options[path.selectedIndex].value;");
}
}
}
View 5 Replies
Similar Messages:
Aug 11, 2010
I've added this code below to a MOSS 2007 web part inside OnPreRender() method.
if (!Page.ClientScript.IsClientScriptBlockRegistered("jump_to_anchor_JS"))
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "jump_to_anchor_JS", "window.location.hash="anchor";",true);
}
The page loads, jumps to the specific anchor, then jumps back to the top of the page. This has been tested in IE8, Firefox, Chrome, and Safari with same behavior.
View 3 Replies
Apr 7, 2010
I am trying to render a simple hyperlink that links to a named anchor within the page, for example:
<a href="#namedAnchor">scroll to down</a>
<a name="namedAnchor">down</a>
The problem is that when I use an ASP.NET control like asp:HyperLink or HtmlAnchor, the href="#namedAnchor" is rendered as href="controls/#namedAnchor" (where controls is the subdirectory where the user control containing the anchor is). Here is the code for the control, using two types of anchor controls, which both have the same problem:
[code]....
I am using the HtmlAnchor or HyperLink class because I want to make changes to other attributes in the code behind. I do not want to introduce a custom web control for this requirement, as the requirement I'm pursuing is not that important enough to justify abandoning the traditional ASP.NET link controls. It seems like I should be able to use the ASP.NET link controls to generate the desired link.
View 3 Replies
Jun 2, 2010
I have gridview with div tag, i have put div tag becouse when user scroll in grid i dont want move grid header section. Its remaining ther and only move data section. Its working fine.
But my datagrid has facility to master details hiearchy of data, When user click one of button its expand details record of that particular parent item.
When user click expand button my gridview header section jump to top of page. How can i stop it
<div id="dvItems" style="height:300px; width:955px;">
View 3 Replies
Jun 29, 2010
I want to get all html anchor tags on Page.Render event for adding/removing attributes
View 2 Replies
Feb 13, 2011
I have an AsyncFileUpload with an image control to show a preview of the pic that is uploaded. Everything works fine, however on the postback from the asynchFileUpload the page jumps to the top of the page and then after a second or two it goes down to the proper scroll position. What can I do to avoid having the page jump to the top and then back down again on the postback ?
[Code]....
View 6 Replies
Apr 10, 2010
I have a simple aspx page with a few TextBoxes and a submit button. Some fields are required and below the button is a ValidationSummary. The complete form is larger than screen height so one has to scroll down to reach the submit button. If I don't fill all required fields and click on submit validation fails as expected and the validation summary displays some info messages below the button. Validation happens on the client and no postback occurs.
So this all works as wished. But disturbing is that the page moves ("jumps") to top position when I click on the submit button. To see the validation summary one has to move down the page again.
I've tried to set the ShowSummary property to false (which doesn't make much sense): The validation still works (no postback) but in this case the page does not move to top position. So the problem seems to depend on rendering the validation texts.
Is there a way to prevent this page jump?
Update:
The behaviour I described above doesn't seem to be browser dependent. I've tested in five different browsers and it's everywhere the same.
View 2 Replies
Jan 26, 2010
I'm dynamically generating a PDF using ABCpdf which contains a table of contents that would link to other pages within the same PDF. The problem is that the path of the anchor tags in the HTML get changed to an absolute path to a temporary file.For example, ABCpdf would render the link's href:
<a href="#elementId">Link</a>
in the PDF as: file:///C:/Users/Aaron/AppData/Local/Temp/ABCpdf/pdfCMMYPSF.htm#elementI
View 2 Replies
Sep 24, 2010
I have a gridview on a page with a hyperlinkfield that passes two parameters to a gridview on another page.
Here's the code for the gridview on first page:
<asp:GridView runat="server" AutoGenerateColumns="False" GridLines="None"
<Columns>
<asp:HyperLinkField Target="_blank" DataNavigateUrlFields="gtn_run_num,catg_custom_desc" HeaderText="Wages" DataNavigateUrlFormatString="~/Help/HelpPay.aspx?gtn_run_num={0}&catg_custom_desc={1}"/>
[Code]....
What I am trying to do is open the second page to the point in the page where the boundfield valueon the second page matches the hyperlinkfield value selected on the first page. I'd essentially like to anchor the two pages based on a value being passed (catg_custom_desc).
View 3 Replies
Jun 20, 2010
I am using Web Forms Routing in ASP.NET 4 and I am trying to route to a specific location on a page. On that page I have an element like <div id="3"> and I'd like to jump to this anchor from another page. For this purpose I have defined a Route in global.asax:
RouteTable.Routes.MapPageRoute("MyRoute", "Path/SubPath/{PageAnchor}",
"~/MyPage.aspx", true, new RouteValueDictionary { { "PageAnchor", null } });
The HyperLink to link to that page and the anchor "3" is defined this way in markup:
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="<%$ RouteUrl:RouteName=MyRoute,PageAnchor=#3 %>">
Link</asp:HyperLink>
The problem with the generated link is that the # character in the URL gets encoded by %23 this way: http://localhost:1234/Path/SubPath/%233 so that I reach the target page but not at the specified anchor.Is there a way to avoid this unwished URL-encoding? Or any other way to route to an anchor?
View 2 Replies
Feb 23, 2010
Given a web URL, I want to detect all the links in a WEBSITE, identify the internal links and list them.What I have is this:
WebClient webClient = null;
webClient = new WebClient();
string strUrl = "http://www.anysite.com";
[code]...
View 2 Replies
Jan 13, 2010
I have a TabControl (Ajax Control Toolkit 1.0.10618.0) with 6 Tab Pages. On 1 Tab Page I have several internal anchors. I want to use URLs ike [URL]. This link opens Document ID 123 but it does not jump to Link2, probably because Link2 is on the 4th Tab page so it's not displayed initially. All these anchors only appear on the 4th tab but I could not set the 4th tab as general default tab because the 1st tab should be the default tab. When I manually open 4th and call the URL again then it's working fine. So I thought to inspect the Request.URL for '#Link' and , if found, switch to Tab4 automatically, but '#Link' does not appear anywhere in Request.URL.Is there a way to jump to an anchor on a currently not-opened tab?
View 6 Replies
Apr 12, 2010
In a page I use prettyPhoto (a lightbox clone) that open a modal window showing an image when I click on a link with rel=prettyphoto. So I have:
<a href="fullresimage.png" rel="prettyPhoto">click here</a>
everytime I click on the link a postback is fired (IsPostBack = false). Can I avoid this? I have a counter on the page and everytime a pic is showed this is recognize as a full page load (i.e. increment counter) as IsPostBack = false!
View 4 Replies
Dec 24, 2010
I am having a web form initially which have href as follows
<a href="downloadInfo.aspx">ACH File Management System Trail(msi)</a>
<a href="downloadInfo.aspx">ACH File Management System Trail(zip)</a>
These are my two anchor tags when i click on this i will redirect both to a same page where user has to fill details and a mail will be send to the user for the given mail id. When the user clicks on mail i would like to have the download for which he opted to download. If msi means i would like to prompt msi file to be downloaded and if zip it should be downloaded I need this to be worked with out using query-string
View 2 Replies
Feb 16, 2010
I am using C# code in an event handler for a button click event in a web page that I would like to have access another web page for the user to see after certain processing is completed. What C# code do I use to execute another page in the same website?
View 1 Replies
Aug 24, 2010
I have a custom user control that contains within it a repeater control. Inside this repeater I programmatically add another custom user control, which contains a text box and a custom validator. This final custom user control can be added any number of times depending on the application's logic. All of this is part of a wizard step. When the user completes the step, if any of the data added to the text boxes is incorrect the validator gets fired on post back. However, because I can have any number of these controls added to the repeater, the user has to scroll down to see any of the incorrectly completed boxes.
Due to the controls being added dynamically it is not possible to use a validation summary control - I have tried!!! Therefore, is there away I can use JavaScript to position a cursor or to jump to each incorrectly completed textbox without the user needing to scroll down the page? For example, if there are 10 textboxes, and textboxes 8 and 9 have numbers inside them inside strings, then the JavaScript should jump textbox 9.
View 1 Replies
May 7, 2015
I have two pages manager and user both have drop downs as
Week, Months and Years.
User have to enter some data week wise for each months and Manager have to approve that.
To Approve manager select months and week from dropdown on his own page and then navigate to User page.
How does I should bind the drop down so that if manager select 1st week from it's page and goes to view link of user then in drop down of user selected value shold be the same as selected by Manager on his own page.
View 1 Replies
May 20, 2010
i have some page that display article (for example: www.site.com/article.aspx?articleId=3) i want to put 2 links/buttons Next article and Previous article and after user click, the page display the next or the previous article from data base. i need some code that jump to the next db row not by -1 or +1 cause maybe article was deleted and there is no such id number like 4 or 2, so to jump to the next/previous article available. any idea? if some one can help me with LINQ TO SQL it will be better (the site is allready builded with LINQTOSQL
View 3 Replies
Dec 14, 2010
I noticed that the "disabled" property that appears in Intellisense for a link control doesn't work (when set to either True or False)..how can I programmatically accomplish the contextual disabling of a hyperlink via Visual Basic?
View 6 Replies
Oct 6, 2010
<a href="#testingPara">
<input type="button">
</a>
this code works
<a href="#testingPara">
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
</a>
this doesn't workCan any one tell me the reason??
<a id="testingPara">
<p>Testing the anchor tags</p>
</a>
View 3 Replies
Apr 29, 2012
I have image button in my page i want when user click on image button it go to the bottom of the page
i know this code
1. The link which when clicked will goto bottom
<a href = "#bottom">Goto bottom</a>
2. The link to be placed at bottom of page
<a name = "bottom"></a>
but i have an imagebutton i want for imagebutton do that.
how i can do it?
View 1 Replies
Aug 3, 2010
I have a strange problem that I don't understand about DataPager. After changing the page set (pages 6 - 10 for example), and clicking on a page (6, 7, 8, 9 or 10), it will displa to the first set of pages counting from 1 again.
Let me explain. I have a ASP.Net page with Listview and DataPager.
<asp:ListView ... DataSourceId="EntityDataSource" DataKeyNames="id">
<LayoutTemplate>
<asp:DataPager runat="server" ID="DataPager1" PageSize="15">
<Fields>
[Code].....
All this works, but the problem is that the set of pages will not remember during postbacks. Let me explain this.
By first request of page, the pages show:
<< 1 2 3 4 5 ... >>
By clicking the ..., the next set of pages will be displayed (and also the data of page 6 will be displayed)
<< ... 6 7 8 9 10 ... >>
But when I click on page 7 to 10, the pages text will display the first set of pages 1-5.
View 1 Replies
Jan 23, 2010
my requirement is like this:
i have two data tables. one data table i am binding to Datalist. based on one column value in the first datatable i have to get values from another datatable and need to bind to the Datalist as hyperlink(or anchor tag).
View 2 Replies
Jul 7, 2010
I am working on asp.net 3.5.
Is there any server side event for anchor tag( href tag)?, I tried with onclick event but it's not working(gives me error)
View 4 Replies
Dec 27, 2010
i want to add event to anchor link in marquee and definite this event in other page.
i tell better,
i have a method in DAL class that read top news of database and add to marquee,so
i call this method in newspage.aspx and when i click this anchor link of marquee then display the news.
i want to increase the view count of news in database,but when i click the anchor,i can not add Method with named "IncreaseViewCount" in anchor click event.
how i can add this method('IncreaseViewCount') in click event of anchor lik in the marquee.
for summary, i want increase the view count of news when display the news in newspage.aspx.
www.mysite.com/newsDisplay.aspx?newsid=3
View 13 Replies