Bunch's Blog

One day I'll have a catchy subtitle, one day
posts - 87 , comments - 125 , trackbacks - 0

JavaScript

There are 10 entries for the tag JavaScript
New Window Via JavaScript Clears Parent
This is not a new item at all but I came across it recently. For an app I had been using some JavaScript like: javascript:window.open(some... here) to open a new window via a button. That bit of code had been working great in several other apps. Then in one app that same code decided to open the new window correctly while clearing the parent of everything but [object]. The fix ended up being simple, change the javascript to: javascript:void(window.open... here); Then it worked like ......

Posted On Friday, May 25, 2012 1:28 PM | Comments (0) |

Two Values Enter, One Value Leaves

This is a fairly easy way to compare values for two different controls. In this example a user needs to enter in a street address and zip code OR pick a county. After that the application will display location(s) based on the value. The application only wants a specific street/zip combination or a county, not both. This code shows...

Posted On Wednesday, December 22, 2010 1:47 PM | Comments (0) |

Dojo and Separate JavaScript File
For a project I needed to use the ArcGIS API for some mapping. To use this you need to use Dojo but in this case all it really comes down to is adding some require lines and a addOnLoad on your web page. At first everything was working great, the maps rendered and the various layers would populate as needed. Once it was working I started moving the various javascript functions into their own files to keep everything nice and neat. Then the problems started, mainly the map would not show up any more. ......

Posted On Wednesday, December 22, 2010 1:17 PM | Comments (0) |

Setting the SlideShowExtender's Index
The AJAX SlideShowExtender is pretty useful. It does what it says and works without much fuss. There was one trick I needed it to perform that I could not find natively within the control. That was to set the slide’s current index. With a little JavaScript however I could make the control do what I wanted. The example below assumes a few things. First you already have a SlideShowExtender setup and working (or see this post). Second this SlideShowExtender is on a page all by itself so the index to ......

Posted On Wednesday, December 22, 2010 9:50 AM | Comments (0) |

URL Parameter Cleanup in JavaScript

Using a JavaScript function to show another window from an aspx page is pretty common. Often times you need to pass some variables by appending them to the URL string. And sometimes you don’t know which variables you may or may not need. This example shows one way of passing the variable(s) you need.

Posted On Monday, September 20, 2010 2:20 PM | Comments (1) |

Accordion Arrows
This is one way to have up/down or open/close arrows appear on an AJAX AccordionPane. First add a div and an img to the Header of the AccordionPane along with the title (the example uses ‘Add Widget’). <cc1:AccordionPane ID="apTest" runat="server" > <Header> <div id="div1" onclick="UpDownIcons('imgAc... Add Widget&nbsp;&nbsp;&... src="Images/arrow_down.ico" id="imgAcc" alt="expand" /> </div> </Header> Note the onclick function for the div, that ......

Posted On Wednesday, June 24, 2009 3:35 AM | Comments (1) |

Passing a GridView value to Javascript
This is a similar technique to the one outlined in this post. The idea is simple, you have a data value that you want to pass to a Javascript function through a button click on a GridView row. The example below shows how to pass a variable, in this case OtherID, to a Javascript function that opens a new modal window which holds a different aspx page. function ShowOther(OtherID) { window.showModalDialog('Oth... + OtherID, 'dialogHeight:600px;dialogW... } In the GridView ......

Posted On Monday, June 8, 2009 7:33 AM | Comments (10) |

JavaScript: Hurdling the ScriptManager
This piece of code is related to a previous post of JavaScript Window from Code Behind. The idea is the same; I needed to get some JavaScript to run from the code behind. For this example it was to open a new window. The real difference with this and the previous post is using ScriptManager instead of ClientScript. VB.Net Code Dim strScript As String = "<script language='javascript'>" strScript += "window.open('URL Goes Here');" strScript += "</script>" ScriptManager.RegisterStart... ......

Posted On Friday, June 20, 2008 9:54 AM | Comments (1) |

Javascipt Window From Code Behind
Something that stumped me a few years ago was trying to code a Javascript window (i.e. alert, confirm) from the code behind. I’ve listed some code below on how I did it in VS2005 using VB. For VS2003 the idea is the same but use Page in place of ClientScript and remove the GetType(String) parameter. One thing you do lose when doing it this way is any execution control that goes along with let’s say a confirm window. The window will appear but the rest of the code in the code behind sub or void will ......

Posted On Thursday, May 15, 2008 9:53 AM | Comments (0) |

Hello

Hello everyone!

This is my first post on my blog here so this is more a test than anything. I hope to blog about various items regarding SQL Server, VB.Net, ASP.Net and Ajax/JavaScript. Other technical blogging interests will most likely revolve around Windows, Linux, PC hardware and the XBox 360. Outside of the geeky realm I'll mostly write about soccer (or football if you prefer). Yeah I'm a Yank but I still love the beautiful game!

Bunch

Posted On Tuesday, March 4, 2008 11:23 PM |

Powered by: