Web Forms :: Link Button With JavaScript / Window Updates But Does Not Refocus By Putting It Back On Top

Feb 12, 2010

I have a link button on my page which has both an Oncommand event and an OnclientClickevent.

The idea is that the oncommand updates some data via a postback and redisplays the page with the updates. The onclientclick event opens a new window.

The new window is named so there is only ever one instance of it.

What I'm trying to do is this.

Open a new window (if its not already opened) and ensure it is on top of the parent window. The new window is a smaller size so the parent window is still visible beneath. On the first occurance the new window opens above, however when I refocus on the parent to click again, the new window updates but does not refocus by putting it back on top.

View 1 Replies


Similar Messages:

Security :: Sign Out Link / Click The Back Button On Browser, Still Go Back Into The Site?

Jun 24, 2010

I've created a Sign Out link on my page, just like the one you see on the top right hand corner of this forum.

This is the code i use :

<asp:HyperLink NavigateUrl="~/Login.aspx" ID="hypSignOut" runat="server" Text="Sign Out"></asp:HyperLink>

However, after signing out, I click the back button on my browser, I can still go back into the site. How do I prevent this?

View 3 Replies

Link Button And JavaScript / Change A Standard HTML Input Button To A Link Button

Mar 1, 2011

I need to change a standard HTML Input button to a Link button but am running into problems because the existing

code calls a javascript function. The function basically does the same as the browser back button. When I add the code and

set the property runat="server" I get a "CS1026: ) expected".

Quite new to ASP,net (VS2010) so could be going about this the wrong way.

[Code]....

[Code]....

View 6 Replies

Web Forms :: How To Open A New Window Using Link Button

Feb 9, 2010

I am trying to navigate it to another page using Link Button and in the .cs file, I am using Response.Redirect. But I want it to the open in a new window.

The reason why I cant use hyperlink is I cant use Command Arg and Command Name which I am using in the Link Button.

I tried the below Javascript, But it's coming as a pop up for the first time when it loads. I don't want it in that way also.

Is there a way like Hyperlink '_blank'.

public static void OpenNewWindow(string url, Page thispage)
{
string fullURL = "window.open('" + url + "', '_blank', 'fullscreen = no, status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,titlebar=yes' );";
ScriptManager.RegisterStartupScript(thispage, typeof(string), "OPEN_WINDOW", fullURL, true);
}
.cs
<asp:LinkButton ID="lbtn_photo" runat="server" Text="Upload Photo"
OnClick="Upload_Photo"></asp:LinkButton>
protected void Upload_Photo(object sender, EventArgs e)
{
Response.Redirect("UpPhoto.aspx?id=" + Request.QueryString["id"]);
}

View 8 Replies

Web Forms :: How To Open New Window On Click Link Button In Gridview

Jun 26, 2012

i have gridview with link button.. if i click on link button to open new window with pdf file.

View 1 Replies

Web Forms :: Popup PDF Window On Link Button Click Within GridView

May 26, 2012

I have one GridView in that I have 2 columns With One Label and One Link Button

InvoiceId      ViewInvoice      

by clicking on ViewInvoice Link button User can open Invoice in New Page.. For This I Bind i used following code

 <Columns>
<asp:TemplateField ItemStyle-Width="15%" HeaderStyle-HorizontalAlign="Left">
<HeaderTemplate>
Invoice
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblInvoice" runat="server"></asp:Label>

[Code] ....

Code behind

protected void GvInvoice_RowDataBound1(object sender, GridViewRowEventArgs e) {
DService.IN_Invoices inv = e.Row.DataItem as DService.IN_Invoices;
if (inv != null) {
Label lblInvoice = (Label)e.Row.FindControl("lblInvoice");
if (lblInvoice != null) {

Here I am trying to get invoiceId throgh lblInvoice andmy invoices are atored as same as invoiceno.Pdf...  ImUnable to open That InvoiceinnewWindowButIf i useBelowLineIts working fine.

Response.Redirect(string.Format(URL_Invoice, e.CommandArgument.ToString()));

What should I do to invoice get open in new window...

View 1 Replies

C# - Open Page In New Window When A Link Button Is Clicked

Sep 27, 2010

I was trying to open a new window when a link button is clicked.

<asp:LinkButton ID="lnkpackageinfo" CssClass="linkclass"
runat="Server"
OnClientClick="lnkpackageinfo_Click()">Compare Packages</asp:LinkButton>

I want the target page to be given in the code behind because in the target page i want to use querystring to hide few buttons and links. It is clear

protected void lnkpackageinfo_Click(object sender, EventArgs e)
{
long MerchantID = CommonHelper.GetLoggedInMerchant();
string querystringpackageinfo = ApplicationData.URL_MERCHANT_COMPANY_PACKAGE + "?MerchantCompanyPayment";
Response.Redirect(querystringpackageinfo, false);
}

View 3 Replies

AJAX :: Javascript Window.history.back() With Modal Popup Extender

Sep 30, 2010

I have a asp.net page that has a list of items. When one of the items from the list is clicked a details page is displayed. This details page has a link button to show a popup for history of the item. The details page also has a button with text 'Back'. The back button has onclick event set to "javascript:window.history.back();".

This back button works fine and goes back to the first page. However when the user is on the second page and opens the pop up by clicking on the link button, the back button stop working and displays Webpage has expired message.

View 2 Replies

Clicking Browser Back Button Is Opening A Link In The Previous Page?

Apr 22, 2010

I am using the below code

[Code]....

In the page there are two links. When i click the first link it opens a window in a new page. I do this by using the above code.

I am clicking the second link in the page and navigating to another page. Now i am clicking the browser back button. Supprisingly its opening the first link.

How clicking back button is opening the link in the page. I am using c# .net 2005.

View 1 Replies

Web Forms :: 1.1 - Button Post Back After Javascript Execution

Jun 2, 2010

I have created a listbox that the selected items would remove by using javascript once I clicked on a server button. Below is the code I'm using

<asp:button id="btnSelected" Runat="server" CssClass="InputFormObject" Text=">" ></asp:button>
<script language="javascript">
function removeOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
if(selectbox.options[i].selected)
selectbox.remove(i);
}
return false;
}
</script>

private void Page_Load(object sender, System.EventArgs e).......................

View 5 Replies

Web Forms :: Disable Back Button Of A Browser Using JavaScript

Oct 11, 2012

How to disable the back button of a browser using Javascript.

View 1 Replies

Data Controls :: How To Open Popup Window On Click Of Link Button Inside GridView

Oct 8, 2013

<a href="display.aspx?code=<%# Eval("code")%>"> click </a>

opening a new page with a parameter value as shown

a javascript with a url with any querystring is a normal.

i get the parameter  value in the Eval("code") only.

the new pages opens as a normal page and not as poup

View 1 Replies

Javascript - Window.showModalDialog And Postback Button

Feb 2, 2011

I have two pages A.aspx and B.aspx Page A.aspx opens B.aspx as modal popup by javascript function window.showModalDialog("B.aspx"); Page B.aspx has two text boxes (Login, Password), <asp:Button> control and button click event in server code. Problem is when I click on the submit button it opens me B.aspx page in new third window How is it possible to not open new window on submit button.

View 3 Replies

Internet Explorer's Back Button And Javascript?

Dec 21, 2010

I've got an asp.net page that uses dynamically populated DropDownLists and OnSelectedIndexChanged events. A few days ago I found a defect where hitting the back button would load the previous page from the browser's cache, so the DropDownList would already have a selected index (hence the OnSelectedIndexChanged event would not fire properly as it didn't have the default selected index). I understood the issue and googled around. It's a well known issue that doesn't have an easy solution because of how the browser interacts with the page. After a bit of thought, I went with a trivial javascript solution to reset the ddls:

var gvTable = document.getElementById("foo");
if (gvTable != null)
{

[code]...

This worked well and I was happy. Until I tested it in IE. In IE, it appears to run the script, THEN load the cached values of the DDL. That is, I observe the DDL snapping back to the 0 index, and then suddenly dropping down to the previously selected value. I'm sort of at a loss here, I typically debug in firebug, but this works perfectly in firefox and chrome.

View 1 Replies

Javascript - Div's Class Not Persisting When 'back' Button Is Used?

Aug 18, 2010

I have an ASP.NET page that contains two div's. Both have search fields and a search button contained within each of them. When I first come to this page, Div A has the class 'SearchDiv' while Div B has 'SearchDivDisabled'. These classes change the appearance so the user knows which search type they currently have enabled.

When Div B is clicked, JavaScript changes it's class to 'SearchDiv', and changes Div A to 'SearchDivDisabled'. This all works like a charm. The problem I have is when a user changes to Div B, clicks Div B's search button (which obviously redirects to a results page), and then uses the browser's back button. When they return to the search page, Div A is enabled again, and Div B is Disabled, even though they last used Div B. In the search button event handler I set the class attribute of the Divs before I redirect, hoping this will update the page on the server so when the user returns, their last-enabled Div will still be enabled (regardless of which one was enabled when the page was first visited).I believe this involves the ViewState, but I'm unsure why the class attribute is not saved so when the user returns to the page it is restored.

Edit: Here is the button event handler code:

protected void RedirectToResults(int searchEnum, string resultPage)
{
ShowContainer(searchEnum);[code]....

RedirectToResults() is called from the actual button event handler with the enum representing the selected search panel and the results page url. SearchContainers is a dictionary mapping an integer to the search Div. The important code is the last line, where I'm updating the selected search container with the 'active' search class, rather than the disabled one (which I assign to the other div(s) )

Additional Update: I have been battling with this issue for the last couple days. I was sort of able to get the following code to work (in page_load):

Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
Response.AppendHeader("Expires", "0"); // Proxies.

But this really isn't a solution, as everything else that gets cached correctly is lost, which leaves me worse off than when I started. Everything else seems to persist fine, it is just the class of the div that is causing me struggles.

Edit: Just wanted to update this for anyone else that comes across this. While I believe there is a solution here with setting the cacheability of the page to force the browser to postback, I could not get it working 100% with all browsers (primarily Firefox was giving me fits, which is a documented bug). I do believe the cookie solution would work, but I felt that may be a bit more complex than necessary for just trying to store the state of a couple div's.

What I ended up doing was tying the div's class to the state of it's correlating radio button (there are radio buttons next to the div which allow the users a more visual way of enabling search panels). I noticed these radio buttons retained the correct checked value when the back button was used, so I could guarantee they would indicate the correct div to be enabled. So in JavaScript's onload I check which radio button is enabled, and then adjust the classes of the search div's accordingly. This is a pretty big hack, but has worked 100% across all browsers, and only took about 10 lines of JavaScript.

View 6 Replies

Open A File Share Link From Window.open Javascript?

Aug 2, 2010

I am trying to open a file share link from the window.open ... but its adding the http://localhost/vdir/ before the path can any one say what is the problem?

View 1 Replies

Javascript - Disable Link Button In A Gridview?

Oct 18, 2010

I have one grid view that contains some template columns. In this, the first column contains check boxes named as Read, fourth and fifth column contains asp:link button. If the user clicks on the read check box, both link buttons should be enabled (Initially it is in disabled mode). I used this JavaScript code for disabling.

function EnablePermissoin(chkB, cellNumber1, cellNumber2) {
var IsChecked = chkB.checked;
if (IsChecked) { [code]....

View 1 Replies

AJAX :: Enable Button Javascript In ModalPopup Window

Apr 6, 2010

I'm trying to enable a button through javascript when a checkbox is checked. This works fine in one of my pages, but on one page the button and checkbox in within a ModalPopup window, and there it doesn't work. How can I work around this?

javascript: document.getElementById('<%=okBtn.ClientID%>').disabled = false;

View 6 Replies

Popup Window From Javascript And Disable Its Close Button?

Jun 19, 2010

I have opened a pop up window from javascript.I want to do some work with this window

1- want to disable its close button

2- want to show this window always on top

3- want to change toolbar color.

View 6 Replies

C# - Create A Back Button That Uses Javascript Or Response.redirect

Apr 22, 2010

Im using asp.net c# (webforms) I want to add a back button to my page. (you land on this page if you incorrectly fill in a form). if javascript is enabled i want to go back via javascript, but if it is disabled i'll just do a response.redirect("~/home.aspx"). how can i implement this? is it 2 buttons? how can i hide the other in the 2 different states if so.

View 2 Replies

Javascript - C# - Enable Button Ontextchange Without Posting Back?

Mar 22, 2011

so i have a lightbox in which pops up an aspx page with textboxes and two buttons (submit - disabled and cancel - enabled). I wanted to enable my submit button ontextchange. it works fine when opened separately (not as a lightbox) but when i let it run normally with the lightbox function everytime ontextchange gets triggered the whole page refreshes disabling the lightbox.

<asp:TextBox ID="textBox1" runat="server" OnTextChanged="OnTextChanged_AttributesEdited" autopostback="true">
protected void OnTextChanged_AttributesEdited(object sender, EventArgs e)
{
btnSubmit.Enabled = true;
}

now if i take out the "autopostback=true" it then will not trigger the the ontextchanged. was wondering if is it better if javascript will be the way to go for enabling the button or is there a way where i can prevent the postback when ontextchanged is triggered?

View 2 Replies

Javascript - Disabled Link Button Still Submitting In Webform?

Dec 15, 2010

I'm trying to disable a link button to prevent the user from submitting several times.

I've seen many questions like this here on SO, most people suggest the following javascript:

button.disabled = true or button.disabled = 'disabled'

Which indeed disables the button (the button is greyed out), but the problem is that it's still clickable, and still submits!!

Here is my stripped down code:

function ValidateButton(button){
// some other code
button.disabled = true;
button.value = 'Processing...';
}
<asp:LinkButton Text="Submit" ID="btnSubmit" runat="server" onclick="btnSubmitRow_Click" OnClientClick="return ValidateButton(this);"/>

Why is the button still clickable, and submits after being disabled ? The button text is still "Submit" not "Processing...', why?

View 5 Replies

Disable Back Button (showing Cached Version) Without JavaScript

May 29, 2010

I want to disable the broswer back button without using javascript. So far i have used this coding:

Response.CacheControl = "no-cache"
Response.CacheControl = "private"
Response.CacheControl = "public"

It's working fine in the internet explorer 8 but in case of mozilla fire fox it is not working.pls say same the solution to work in all browsers.

View 2 Replies

Link Buttons In Masterpage - JavaScript Conflict With Button On Page?

Apr 22, 2010

I've got two linkbuttons on a masterpage. It works fine on all pages apart from page I have a form where if I click on one of the link buttons, then the wrong javascript event is fired. It is firing the button on the form if I click on the button on the masterpage.

View 1 Replies

Javascript - Window Scrolling Button Control - Rendering To Normal Position

Nov 9, 2010

In web application, i tried scrolling the window vertically by increasing a y axis height to 500 with a javascript that is attached to OnClientClick event of a asp.net button control with id Button1. The script i have used is

<script language="JavaScript">
function scrollToWindow()
{
window.scrollTo(0,500);
}
</script>

and the button code is as follows

<asp:Button ID="Button1" runat="server"
Text="Scroll to bottom" OnClientClick="scrollToWindow()" />

If i run this page and click that button, the page scroll is not working properly. when i put alert inside that script and debug, i found that the page is actually scrolling to 0,500 but again its rendering to its normal position because of some reasons. Overcome this issue and let me know the reason behind that?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved