I'm using VS2010/C# to develop my ASP.NET web project. I want my users to view bottom of page after clicking on a button. How can I do so? Can I use JavaScript, and if so, what is the function I should use?
Use an Anchor tag?
The Link
bottom
This would be at the bottom of the page:
<a name="bottom"></a>
If you want this behavior on an ASP.NET control like a <asp:button> and not a regular link for your button, then on the PostBack in your code-behind, you'd need to do something like below to spit out some JavaScript to jump the user down to that position.
ClientScript.RegisterStartupScript(this.GetType(), "Anchor", "location.hash = '#bottom';", true);
Use a html anchor tag to link to an anchor at the bottom of the page.
you simply need to use client side HTML Anchor, links with:
href=#bottom
see here for info: http://www.echoecho.com/htmllinks08.htm
Related
I have put sign out button in master page. I have a page in which I use that master page and I also have update panel in this page. When I click on sign out button , it does not work. When I use anchor tag it works but I want to use Button.
Thanks,
this might be happen if you are using requiredfield validations for some input fields. try
CausesValidation="false"
for the button control and check. hope this help you.
I had the same problem and I solved deleting the main div nested in the asp Content placeholder. For me all the controls inserted in the masterpage was freezed, buttons, dropdown box, all in other words.
I have an Asp.Net Menu control that displays across the top of our page. When the page is loaded, all the dymanic menus (the ones that fly out on mouseover) display until the page finishes loading, and then hide. Once the page finishes loading, they hide and behave as they should, but they are displayed until loading is complete.
Anyone have any suggestions on why this is happening or how to get it to stop?
Hide the menu with your css display:none and then use jquery to display it:
$(document).ready(function() {
$(yourclass/idhere).toggle();
});
dont use asp.net ready to use controls, u dont know the code they produce. As a web developer u have to knoq exaclty what ll be the code at the page.
As for answer, you may hide your menu by adding display:none style to your menu, and in javascript write a code to show it after page loads.
I'd like to create email dialog that has several inputs including message textbox plus some other custom info. I'd like it to display center screen over top of main page setting the opacity to like 50%.
do i create the pop up as anohter aspx page or panel?
Not sure what to use here, z-index, modalPopupExtender, Javascript, jquery. looking for easy and something stable.
I would look into the ModalPopupExtender in the AJAX Toolkit.
You can also try creating the dialog with jQuery. If you decide to go that route, check out the jQuery UI dialog:
http://jqueryui.com/demos/dialog/
In my C# asp.net 3.5 web application I am having controls like div tag inside that one textbox and one check box and the page is having a submit button. So in this submit button click I want to make the controls inside the div tag visible.. I am calling a JQuery function to do this. All the statements are getting executed but the control is not visible..
Following is the code in my JQuery function
$("input[name$='QuestionAndAnswerEditorDiv']").show();
$("input[name$='answerLabel1']").show()
$("input[name$='wmd-AnswerTextBox']").show()
My div tag and its controls in the user control page are like the following
<div id="QuestionAndAnswerEditorDiv" runat="server">
<div id="wmd-button-bar" class="wmd-panel wmd-button-row"></div>
<textarea name="QuestionandAnswerTextArea" runat="server" id="AnswerTextBox" onkeyup="prettyPrint();" class="wmd-input editor" cols="92" rows="15"/><div class="wmd-preview text-preview preview" style="-ms-word-wrap: break-word;"></div>
As I noticed these controls are make visible=false in another page so they are not coming in the page source.. So Let me know how to work these controls now
all web server controls in asp.net < 4 are not rendered using their given name.
to use the rendered name use Control.ClientID
Setting QuestionAndAnswerEditorDiv.Visible = false; will mean that it doesn't get rendered to the page. In your code behind do the following:
QuestionAndAnswerEditorDiv.Attributes.Add("style", "display:none");
QuestionandAnswerTextArea.Attributes.Add("style", "display:none");
the JQuery show() function uses the display property and will set it to "block", which will make it visible.
This may not work because div is not going to render as input element and label is rendered as span element in asp.net so check for the type of controls
for div
$("div[name$='QuestionAndAnswerEditorDiv']").show();
for label
$("span[name$='answerLabel1']").show()
for textbox
$("input[name$='wmd-AnswerTextBox']").show()
Edit :
so as i suggested in my answer make use of proper jquery selctor so that this will work for you
Edit 1
So rather than making control visible= false set there sytles to disply:none so that controls avaialbe on you page and you can play with them using jquery/javascript
I was wondering if there is way to open another page using a Modal Popup Extender?
and if there is can someone please the tell me how do i go about doing it ..
Thanx
Owais
You could probably put an iframe pointing to the page within the Modal Popup Extender, however that would be a bit of a hack. I would recommend putting whatever content on that page into a user control and then referencing that control from both the original page and the page with the modal popup.
Try using an HTML iframe as the target control of the extender. The iframe tag has a "src" attribute that should point to the page you want to show in the dialog.
You have to think about it w/o the illusion - fundamentally the modal popup is just a DIV. So the question is "can you display a different page in a div?". Iframe... or perhaps a webservice call.
you can use a user control and load it dynamically into the modal popup
Dim ctrl As Control
ctrl = Me.Page.LoadControl("~/control/cmsbar.ascx")
ctrl.id="ctrlx"
Placeholder1.Controls.Add(ctrl)
popup.Show()
note that the popup will have a placeholder to add the control to. you must give the user control an id so the viewstate can be loaded for the control . this code must be placed in the Page_Init event so when the user control is created for the second time it loads its view state