How to scroll the browser window - c#

I am using C# code and displayed the Page and when i click on the link button on the top of the page then the page should scroll to the bottom of the page because the related content will be on the bottom of the page.
How can i achieve this
can u give me the solution for this scenario either programatically in c# or in jquery
Thanks in advance
Vara Prasad.M

Here's a nice plugin that allows you to easily scroll to any part of the document.

Related

how to scroll to a position in a page by clicking on link

Hi coder i am new to jquery. i serach alot but fail to find this what i am looking is not a customize application, i just want process or method how we can achieve this.
Suppose i have a menu or link like below
Home
About
Contact
As a link or menu and when i click on that any of the link or menu i srcoll down to position of the page where details for it present..
Just like This link where click on the above menu scroll to the
position of it on the page
This should be a single page application.
Any idea's or tutorial for this i want to do it jquery.
I can use scrollup(), scroll(), animate() but how to proceed this that is the main concren any help would be appreciated.
Are you by any chance talking about HTML anchors?
http://www.echoecho.com/htmllinks08.htm
This is the best link for your solution
Single Page Site with Smooth Scrolling, Highlighted Link, and Fixed Navigation
In this link you get how to stick your menu using this
$(window).scroll(function () {
var window_top = $(window).scrollTop()+12; // the "12" should equal the margin-top value for nav.stick
var div_top = $('#nav-anchor').offset().top;
if (window_top > div_top) {
$('nav').addClass('stick');
} else {
$('nav').removeClass('stick');
}
});
use scrollto.js file to scroll through the page and call it in that function for smooth scrolling
$("nav a").click(function (evn) {
evn.preventDefault();
$('html,body').scrollTo(this.hash, this.hash);
});
I hope this will help you
$('html,body').animate({scrollTop: $('#scrollToId').offset().top});
Check this solution jQuery scroll to element

Selenium to click on a javascript button corresponding to a text

I have a lot of buttons in my web page and that too are javascript buttons. All those buttons have same TagName, but different id. But I cant use ID since I cant predict which button has to be clicked.
Selenium will search for a content (Question here) and if could find the content, then it must click on the respective button. How can it be achieved?
Any comments would be really helpful and appreciated..
This will find a button based on the displayed text on the button and click it.
var loggout = driver.FindElement(By.LinkText("Logg ut"));
loggout.Click();
Or you can change it to;
By.Id()
By.CssSelector()
By.Name()
...

how to hide the master page content in a web page

I want to open a regular .aspx page in a rad window.But the regular page consists of Site Map.I don't want that sitemap to be displayed when it is opened in rad window.
Please suggest me some solution.
I already tried this:
this.MasterpageFile="..//test.Master";
But in my page it does not work
So you will have ContentPlaceHolders which will automatically inherit from the master page. If you go to the regular .aspx page and head into Design view you will see sections with all the content from the Master Page.
If you click the little right arrow to the right of the area that looks like a Div, you should be able to change the content back to what you have in your regular aspx page.
Make a public property on MasterPage to show hide your site map , on your rad window page access that Property and make it hide.
public bool MyProperty()
{
// get and set your controls visibility
}
Access your property like this.Master.MyProperty = false

Reload a Web Page Using C#

I have a web page that prompts for user input via DropDownLists in some table cells. When a selection is made the selection replaces the DropDownList so that the action can only be performed once. In the case that a change needs to be made I want to be able to click a button that reloads the page from scratch. I have Googled and Googled but I have not managed to find a way to do this.
Any advice is appreciated.
Regards.
Put a link on the page with the text "Reload" and the url the url of the page. It's perfectly valid to have a page with a link to itself.
If you don't like the link idea, use a standard Button and in the click event, use Response.Redirect to redirect to the current page.
You can set an OnClick for your button that resets each DropDownList's SelectedIndex to 0 instead of reloading the page from scratch. Alternatively, you can set a Response.Redirect([the page's url]) into the OnClick as is suggested here.

Child webpages help

Using C#, ASP.Net
In my webpage i have the link for the another web page, if i click the link that should display a another page inside the main page like child page.
Another webpage should display like a popup window in my webpage. And also size of the another webpage should be small. How to do this.
Need Help.
For displaying one web page within another look at using frames (or an inline frame - iFrame)
The second part of your question I think is asking to be able to display the link in a separate window. To do this, use the target="blank" attribute in the anchor tag. to set the size of the child window you will need to use javascript:
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>
So just call the showPopup method from your anchor click event
link text
Ideally you would move the javascript so that it is no longer inline, but this should work.
For the first part you need a master page
For the second part you might need a modal popup or it's jQuery equivalent
However, I don't understand what you mean with
And also size of the another webpage should be small. How to do this.
Another webpage should display like a
popup window in my webpage. And also
size of the another webpage should be
small. How to do this.
Did you mean a jQuery Modal Window?

Categories

Resources