Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2007, 07:38 AM
Authorized User
 
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Divs, Gridviews and Javascript != fun

Hi,

I have the following gridview

http://i11.tinypic.com/2hp3jmo.gif

and I want to have a div pop up next to the icon when they click on the little search icon (next to the costcode)
like this -> http://i10.tinypic.com/48yybdy.gif

I have gotten this far.. but the problem is that When I click Select, Search or Clear, it causes a postback, and when the page reloads, the DIV moves back to its original position, or if i set it by default to be invisible, then it disappears.

Any suggestions on how I could get this done?

Basically, I want it to:

1) When i hit select, copy the values to the right fields, and then disappear. (it does this if its set to invisible by default).
2) When i hit search or clear, i want it to modify the filter settings for the sqldatasource, and keep the div where it is.

Maybe i need to use state variables or something and make the page load the appropriate java script based on these variables. Apparently I can set the startupscript from inside the page_load code in the code behind.

Thanks,
Mikey
 
Old January 26th, 2007, 02:10 PM
Authorized User
 
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok i figured it out.

You cant execute javascript from code behind (except at startup in pageload - you can use RegisterStartupScript), and you cant update codebehind variables from javascript, so.. you need to find a common ground. Cookies.

Basically whenever i moved the div, i updated a cookie to say whether or not its visible and its position. then on page load, if it was a postback, i'd read the cookie, and then if it was visible, i would use the RegisterStartupScript to register my function to show the searchpanel and pass it the top and left from the cookie too.

the end.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab across gridviews cdw90nl Javascript How-To 1 February 4th, 2008 05:16 AM
Nested gridviews johncross912 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 November 23rd, 2007 03:04 AM
How to passed an xsl parameter to a javascript fun jadeite100 XSLT 1 June 22nd, 2007 02:51 PM
Gridviews lisabb ASP.NET 2.0 Basics 1 May 29th, 2007 11:40 AM
divs inside divs: theory? Giant_robot_sandwich CSS Cascading Style Sheets 11 September 13th, 2006 03:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.