Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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 June 18th, 2008, 06:22 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default Calendar Control Title Doesn't Position with CSS..

I have a celendar control on my web form, and it works just fine. However I decided I wanted to have it open in an absolute position using CSS, so I created a class just like this:

 .StartCalendarPosition
{
    position: absolute;
    top: 170px;
    left: 250px;
    width: 200px;
    height: 180px;
}



When I click the calendar to open it - it opens exactly where I want it BUT the title did NOT move with it...? In Firefox the "June 2008" is at the right height but spread out through the entire page. In IE7 it is even worse, it is half way down the page and all spaced out.

I tried using the same class for the TitleStyle property, but that did nothing at all.

Why is this happening???

 
Old June 18th, 2008, 06:50 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Bring it up in the browser and then VIEW the HTML SOURCE ("Page Source" in FF).

What do you see for the HTML for the control??

If you can't figure out the needed <STYLE> from that, post the HTML here?
 
Old June 18th, 2008, 07:38 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

It all looks right in the HTML, in fact if I copy and paste it into a new HTML page it looks fine, but not the case in the original aspx page.

Let me ask you this... (as this would solve my problem)

Right now I have 2 calendar controls on my page for a start date and end date. The reason I wanted to use absolute positioning was because in the event a user clicks both the start and end calendar icon before selecting a date it totally messes up the page format. How can I use just one calendar control for both ImageButtons, and in the click even populate the appropriate text box depending on which calendar icon was clicked?

Make any sense?

Right now I simply just have the calendars hidden, when the button is clicked it unhides and the selection is filled. Here is the code:

Protected Sub imgbtn_cal1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtn_cal1.Click
        imgbtn_cal1.Visible = False
        txt_StartDate.Visible = False
        cal_start.Visible = True
    End Sub

Protected Sub cal_start_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cal_start.SelectionChanged
        imgbtn_cal1.Visible = True
        txt_StartDate.Visible = True
        txt_StartDate.Text = cal_start.SelectedDate
        cal_start.Visible = False
    End Sub

I have those functions again in my code behind for calendar 2. So it just a matter of checking the visibility to determine which text box to fill?
 
Old June 18th, 2008, 08:18 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Sorry, you've lost me.

How can the page appearance change when you simply copy the source HTML to a file and then display that file???? HTML is HTML is HTML. The browser has no idea whether the HTML is coming from an ".html" page, an ".aspx", an ".asp" page, a ".jsp" page, a ".php" page, etc.

If, perhaps, when you copy the HTML and try to show it in the browser, you are not getting all the ".js" files or ".css" files that are used in the ".aspx" page, then it would make sense, of course. So try to make the .html version use all the same other external files, to make the experience completely the same.

The code you show makes me immediately suspicious that this is exactly where the problem lies, because you are changing the visibilty state of 3 separate things when the button is clicked:
        imgbtn_cal1.Visible = False
        txt_StartDate.Visible = False
        cal_start.Visible = True

If the styles of those three things are similarly separated, then wouldn't you need to coordinate there style changes, as well???
 
Old June 18th, 2008, 08:37 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

And if it's not obvious, you need to capture the HTML when the page is in it's distorted form, not in the good form.
 
Old June 19th, 2008, 11:33 AM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

I simply meant that copying only the html table for the calendar that got rendered into an html doc was formatted correctly in the display but when viewed in the browser was incorrect. Sorry for the confusing, i tend to ramble.

I got it work by making two different DIV tags, one style for the title and one for the calendar body. When I move them around using CSS positioning they work fine.

I have no idea why two different DIV's would have a different effect than just using one of them for the entire control, but I guess since it is working I will just keep it. I am just the type that cant stand sitting pat when I KNOW it should work the other way! ;)

Thanks for your help though - I always appreciate peoples response...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Position Div with CSS sandeepbhutani304 ASP.NET 2.0 Basics 0 September 19th, 2008 02:17 AM
Online Diary Mod Show Entry Title on Calendar vgharris0 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 April 1st, 2008 12:02 PM
ascx control Title SKhna ASP.NET 2.0 Basics 1 March 18th, 2008 12:24 PM
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Changing Page Title From User Control [email protected] ASP.NET 1.0 and 1.1 Professional 5 October 11th, 2005 08:48 AM





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