Thursday, March 29, 2012
pop up window using javascript
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.g
if">Amex?</asp:HyperLink>
mahsamahsa,
Try set Target=_blank
Thomas Andersson
"mahsa" wrote:
> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex
.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in
<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A>
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.
Dale Preston
MCAD, MCSE, MCDBA
"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
>
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
pop up window using javascript
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink
--
mahsamahsa,
Try set Target=_blank
Thomas Andersson
"mahsa" wrote:
> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in
<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.
Dale Preston
MCAD, MCSE, MCDBA
"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
> > hi how can I open this link in new pop up window using javascript?
> > <asp:HyperLink id="HLink_Amex" runat="server"
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> > --
> > mahsa
pop up windows and triggering an event after closed
I have a javascript onclick event that pops up a window,
allows the user to view information, and then close the window.
Now - I would like to be notified when this window is closed
in the asp.net page that pops it up.
Or - better yet - is there a way to popup the window in a modal mode
where the user must close the window prior to returning to the main web
application (and if at all possible - trigger an event when they are done)?
here is my current javascript for the poup window...
function upload_window()
{
var left = (screen.availWidth/2) - (600/2);
var top = (screen.availHeight/2) - (225/2);
var colorWin = window.open('upload_maps.aspx', "test", 'scrollbars=0, toolbar=0, statusbar=0, width=600, height=225, left='+left+', top='+top);
document.edit_maps_form.submit();
}
thanks for your help!!
take care
tonyThere's no way to do it server-side, but you COULD add JavaScript to do something to the window's opener when the popup window closes, i.e. window.opener.....
2) To show a modal window, use: window.showModalDialog('somepage.aspx','winName','dialogHeight:200px;dialogWidth:200px; etc..');
Remember, this only works with IE.
1) To notify the aspx page when the new window is closed, you can write Javascript:
window.opener.document.FormNameFromASPXPage.someTextBox.Text = "new win is closed";
pop ups
uses JavaScript to open new browser windows and they are being shut down
automatically...Pop up blockers don't block windows that are opened by the same domain as
the page that is loaded.
"mareal" <m@.m.com> wrote in message
news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> Is there any way to programmatically open pop ups with SP2? My ASP.NET
> site
> uses JavaScript to open new browser windows and they are being shut down
> automatically...
Thank you Scott. I am not sure I am following. My browser even blocks
Microsoft pop ups from this forum unless I allow them.
I was hoping to find some kind of command to allow my site to open new
browser windows (overwriting pop ups directives)
"Scott M." wrote:
> Pop up blockers don't block windows that are opened by the same domain as
> the page that is loaded.
> "mareal" <m@.m.com> wrote in message
> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> > Is there any way to programmatically open pop ups with SP2? My ASP.NET
> > site
> > uses JavaScript to open new browser windows and they are being shut down
> > automatically...
>
The pop ups you get from various web sites (including MS) don't actually
have content that comes from the domain you are visiting. Most companies
have special servers dedicated to just serving up the advertising content
(ad servers). For example, the content of a popup ad that you got while
visiting cnn.com might actually be coming from http://ads.cnn.com and the
content of the popup windows you get while visiting Microsoft's web site
might actually be coming from http://ads.microsoft.com.
When you build a web page that includes the window.open() client-side
scripting command that doesn't mean that a popup blocker will prevent that
window from opening. Most popup blockers look to see where the content of
that new window is coming from. If it is from the same domain as the page
that launched it, the popup will be allowed, if not it won't.
For example, visit this page that I built and run for my son's cub scout
pack (http://pack96.org/Calendar/PackCalendar.aspx) and click on one of the
links. You will see that the popup windows do not get blocked even though
your popup blocker is on.
-Scott
"mareal" <m@.m.com> wrote in message
news:DD978129-4376-435E-8F35-C4F80209AD1F@.microsoft.com...
> Thank you Scott. I am not sure I am following. My browser even blocks
> Microsoft pop ups from this forum unless I allow them.
> I was hoping to find some kind of command to allow my site to open new
> browser windows (overwriting pop ups directives)
> "Scott M." wrote:
>> Pop up blockers don't block windows that are opened by the same domain as
>> the page that is loaded.
>>
>> "mareal" <m@.m.com> wrote in message
>> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
>> > Is there any way to programmatically open pop ups with SP2? My ASP.NET
>> > site
>> > uses JavaScript to open new browser windows and they are being shut
>> > down
>> > automatically...
>>
>>
>
pop ups
uses JavaScript to open new browser windows and they are being shut down
automatically...Pop up blockers don't block windows that are opened by the same domain as
the page that is loaded.
"mareal" <m@.m.com> wrote in message
news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
> Is there any way to programmatically open pop ups with SP2? My ASP.NET
> site
> uses JavaScript to open new browser windows and they are being shut down
> automatically...
Thank you Scott. I am not sure I am following. My browser even blocks
Microsoft pop ups from this forum unless I allow them.
I was hoping to find some kind of command to allow my site to open new
browser windows (overwriting pop ups directives)
"Scott M." wrote:
> Pop up blockers don't block windows that are opened by the same domain as
> the page that is loaded.
> "mareal" <m@.m.com> wrote in message
> news:2E000184-7628-4DA2-9906-0ECCE1C93C75@.microsoft.com...
>
>
The pop ups you get from various web sites (including MS) don't actually
have content that comes from the domain you are visiting. Most companies
have special servers dedicated to just serving up the advertising content
(ad servers). For example, the content of a popup ad that you got while
visiting cnn.com might actually be coming from http://ads.cnn.com and the
content of the popup windows you get while visiting Microsoft's web site
might actually be coming from http://ads.microsoft.com.
When you build a web page that includes the window.open() client-side
scripting command that doesn't mean that a popup blocker will prevent that
window from opening. Most popup blockers look to see where the content of
that new window is coming from. If it is from the same domain as the page
that launched it, the popup will be allowed, if not it won't.
For example, visit this page that I built and run for my son's cub scout
pack (http://pack96.org/Calendar/PackCalendar.aspx) and click on one of the
links. You will see that the popup windows do not get blocked even though
your popup blocker is on.
-Scott
"mareal" <m@.m.com> wrote in message
news:DD978129-4376-435E-8F35-C4F80209AD1F@.microsoft.com...
> Thank you Scott. I am not sure I am following. My browser even blocks
> Microsoft pop ups from this forum unless I allow them.
> I was hoping to find some kind of command to allow my site to open new
> browser windows (overwriting pop ups directives)
> "Scott M." wrote:
>
Monday, March 26, 2012
Populate a Listbox by using JavaScript
I have a page with a ListBox on it, and It's also have a some buttons to
populate the ListBox by using JavaScript.
I have no problem with populate the listbox using JavaScript. But when the
page is submited / postback, the listbox is still empty.
Do you have any solution for this case (if I still want to use ListBox
Server Control) ?
thanks,
Devin WoodDevin,
You need to pass the new items to the server. It can be done in a hidden
input html control. On server side you will parse the input's value and
populate the listbox.
Eliyahu
"Devin Wood" <nordlitch@.msn.com> wrote in message
news:Opwr1avLFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I have a page with a ListBox on it, and It's also have a some buttons to
> populate the ListBox by using JavaScript.
> I have no problem with populate the listbox using JavaScript. But when the
> page is submited / postback, the listbox is still empty.
> Do you have any solution for this case (if I still want to use ListBox
> Server Control) ?
> thanks,
> Devin Wood
>
Populate a Listbox by using JavaScript
I have a page with a ListBox on it, and It's also have a some buttons to
populate the ListBox by using JavaScript.
I have no problem with populate the listbox using JavaScript. But when the
page is submited / postback, the listbox is still empty.
Do you have any solution for this case (if I still want to use ListBox
Server Control) ?
thanks,
Devin WoodDevin,
You need to pass the new items to the server. It can be done in a hidden
input html control. On server side you will parse the input's value and
populate the listbox.
Eliyahu
"Devin Wood" <nordlitch@.msn.com> wrote in message
news:Opwr1avLFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I have a page with a ListBox on it, and It's also have a some buttons to
> populate the ListBox by using JavaScript.
> I have no problem with populate the listbox using JavaScript. But when the
> page is submited / postback, the listbox is still empty.
> Do you have any solution for this case (if I still want to use ListBox
> Server Control) ?
> thanks,
> Devin Wood
Saturday, March 24, 2012
populate listbox using Javascript
document.getElementById("lsTest").Items.Add(new ListItem("Test"))
This gives following error message:
'document.getElementById(...).Items' is null or not an object
Also tried:
document.getElementById("lsTest").Add(new ListItem("Test"))
Result - Error Message:
'listitem' is undefined
Any idea?var o = document.createElement("option");
o.text = "test"
o.value = "test";
document.getElementById("lsTest").add(o);
-- bruce (sqlwork.com)
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
| I tried following :
| document.getElementById("lsTest").Items.Add(new ListItem("Test"))
|
| This gives following error message:
| 'document.getElementById(...).Items' is null or not an object
|
| Also tried:
| document.getElementById("lsTest").Add(new ListItem("Test"))
| Result - Error Message:
| 'listitem' is undefined
|
| Any idea?
|
|
Hi RA,
you can not add a listitem from javascript. A ListBox is rendered as
html SELECT element. So, you should add the items in javascript as if you
are adding to a SELECT element, which would be like follows
document.getElementById("lsTest").add(new Option("Text","Value"));
HTH
Kumar
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
> I tried following :
> document.getElementById("lsTest").Items.Add(new ListItem("Test"))
> This gives following error message:
> 'document.getElementById(...).Items' is null or not an object
> Also tried:
> document.getElementById("lsTest").Add(new ListItem("Test"))
> Result - Error Message:
> 'listitem' is undefined
> Any idea?
>
To remove an item from a textbox I tried;
document.getElementById("lsTest").remove(new Option("Testing","Testing"));
and
document.getElementById("lsTest").remove("Testing");
neither of above work. Both deletes very first Item in the listbox.
What I am doing wrong?
"Kumar Reddi" <KumarReddi@.REMOVETHIS.gmail.com> wrote in message
news:Odz5c8PyEHA.3096@.tk2msftngp13.phx.gbl...
> Hi RA,
> you can not add a listitem from javascript. A ListBox is rendered as
> html SELECT element. So, you should add the items in javascript as if you
> are adding to a SELECT element, which would be like follows
> document.getElementById("lsTest").add(new Option("Text","Value"));
> HTH
> Kumar
> "RA" <rchaudhary-nospam@.storis.com> wrote in message
> news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
>
populate listbox using Javascript
document.getElementById("lsTest").Items.Add(new ListItem("Test"))
This gives following error message:
'document.getElementById(...).Items' is null or not an object
Also tried:
document.getElementById("lsTest").Add(new ListItem("Test"))
Result - Error Message:
'listitem' is undefined
Any idea?var o = document.createElement("option");
o.text = "test"
o.value = "test";
document.getElementById("lsTest").add(o);
-- bruce (sqlwork.com)
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
| I tried following :
| document.getElementById("lsTest").Items.Add(new ListItem("Test"))
|
| This gives following error message:
| 'document.getElementById(...).Items' is null or not an object
|
| Also tried:
| document.getElementById("lsTest").Add(new ListItem("Test"))
| Result - Error Message:
| 'listitem' is undefined
|
| Any idea?
|
|
Hi RA,
you can not add a listitem from javascript. A ListBox is rendered as
html SELECT element. So, you should add the items in javascript as if you
are adding to a SELECT element, which would be like follows
document.getElementById("lsTest").add(new Option("Text","Value"));
HTH
Kumar
"RA" <rchaudhary-nospam@.storis.com> wrote in message
news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
> I tried following :
> document.getElementById("lsTest").Items.Add(new ListItem("Test"))
> This gives following error message:
> 'document.getElementById(...).Items' is null or not an object
> Also tried:
> document.getElementById("lsTest").Add(new ListItem("Test"))
> Result - Error Message:
> 'listitem' is undefined
> Any idea?
To remove an item from a textbox I tried;
document.getElementById("lsTest").remove(new Option("Testing","Testing"));
and
document.getElementById("lsTest").remove("Testing");
neither of above work. Both deletes very first Item in the listbox.
What I am doing wrong?
"Kumar Reddi" <KumarReddi@.REMOVETHIS.gmail.com> wrote in message
news:Odz5c8PyEHA.3096@.tk2msftngp13.phx.gbl...
> Hi RA,
> you can not add a listitem from javascript. A ListBox is rendered as
> html SELECT element. So, you should add the items in javascript as if you
> are adding to a SELECT element, which would be like follows
> document.getElementById("lsTest").add(new Option("Text","Value"));
> HTH
> Kumar
> "RA" <rchaudhary-nospam@.storis.com> wrote in message
> news:%23IOtEyPyEHA.2016@.TK2MSFTNGP15.phx.gbl...
>> I tried following :
>> document.getElementById("lsTest").Items.Add(new ListItem("Test"))
>>
>> This gives following error message:
>> 'document.getElementById(...).Items' is null or not an object
>>
>> Also tried:
>> document.getElementById("lsTest").Add(new ListItem("Test"))
>> Result - Error Message:
>> 'listitem' is undefined
>>
>> Any idea?
>>
>>
Wednesday, March 21, 2012
Populate textbox with dropdown selection (in Wizard Control), using javascript
I have a Wizard Control that contains a number of controls:
After the user selects an item from a DropDown, and the control has lostfocus, I need the selected value to pre-populate a TextBox usingjavascript.
If I create a 'new website' and just throw a dropdown list and textbox onto the page the following code works perfectly:
** Default.aspx.vb:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DropDownList1.Attributes.Add("onblur", "FillTextbox()")
End Sub
** Default.aspx:
function FillTextbox ()
{
document.getElementById("TextBox1").value=document.getElementById("DropDownList1").value;
}
The above code, however DOESN'T work if the controls are embedded in a wizard control.
Thus, my question is: How do I get the code to work if the DropDown and TextBox controls are in a Wizard Control?
Any help would be much appreciated!
I believe when the control is embedded within another control the actual name that ends up being used includes the parent-control's name, e.g. Parent_mycontrol. Take a look at the source (right click, View Source) when you run the page to find the actual name of the control. You can reference it by that name in your javascript, fillTextbox() function.
Good luck.
You need to find the correct ID for the TextBox control. As suggested by the fellow developer you need to use the View Source and find the correct ID for the TextBox control. Once, you find the correct ID simply use that Id in the javascript function.
Thank you both SO MUCH for your help! That worked like a charm!
Friday, March 16, 2012
Populating DIV tag from javascript via ASP.Net & ClientScript methods
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.
David Mathew
mathewda@dotnet.itags.org.gmail.comusing masterpages? if so, it changes the client ID
Dave Mathew wrote:
Quote:
Originally Posted by
I'm trying to run some clientside javascript on page load for one of my
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.
>
David Mathew
mathewda@.gmail.com
I think what you are running into is the javascript code being executed
before the elements of your page have been created in the page DOM.
Try to stick your javascript into the onload attribute of your body tag
and see if it will work.
If this does work, I think what you will have to do is register your
javascript with the onload event either by adding it as an attribute of
the body tag or via external script.
http://www.quirksmode.org/js/events_advanced.html
The above article is similar to what you could use to register your
javascript with the load event except of course the event you want to
register for is load (onload in IE) and I believe you want to use
window as your element.
I wrote a javascript register function that handles cross browser
registration a while ago but don't have it with me. Let me know if you
want it and I'll post it. I believe there are also similar examples
out there somewhere on the web.
Clint.
Dave Mathew wrote:
Quote:
Originally Posted by
I'm trying to run some clientside javascript on page load for one of my
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.
>
David Mathew
mathewda@.gmail.com