Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 27th, 2012, 03:52 PM
Friend of Wrox
Points: 576, Level: 8
Points: 576, Level: 8 Points: 576, Level: 8 Points: 576, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 118
Thanks: 35
Thanked 2 Times in 2 Posts
Default Chapter 10 - p. 363

Hi Imar

I had a question regarding tip #2.... I tried moving the UpdateProgress control to the master page, but when after filling out the contact form, I am unable to see the progress indicator in the footer.

Here's the code I added to the footer of the Master page,

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="PleaseWait">
Please Wait...
</div>
</ProgressTemplate>
</asp:UpdateProgress>

Is there a step that I missed?

Thank you.

Tulsi
Reply With Quote
  #2 (permalink)  
Old March 27th, 2012, 04:05 PM
Imar's Avatar
Wrox Author
Points: 67,755, Level: 100
Points: 67,755, Level: 100 Points: 67,755, Level: 100 Points: 67,755, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,287
Thanks: 66
Thanked 1,439 Times in 1,419 Posts
Default

Hi there,


It works for me when I cut the UpdateProgress control from the ContactForm, paste it in the footer div of the master and remove the AssociatedControlID.

Where in the footer did you paste it? And did you leave the UpdatePanel in the user control?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old March 28th, 2012, 01:58 PM
Friend of Wrox
Points: 576, Level: 8
Points: 576, Level: 8 Points: 576, Level: 8 Points: 576, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 118
Thanks: 35
Thanked 2 Times in 2 Posts
Default

I put it in the footer div...

<div id="Footer">
Footer Goes Here

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="PleaseWait">
Please Wait...
</div>
</ProgressTemplate>
</asp:UpdateProgress>

</div>

Also, I made sure that the update panel was left in the control.

Thanks

Tulsi
Reply With Quote
  #4 (permalink)  
Old March 28th, 2012, 02:03 PM
Imar's Avatar
Wrox Author
Points: 67,755, Level: 100
Points: 67,755, Level: 100 Points: 67,755, Level: 100 Points: 67,755, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,287
Thanks: 66
Thanked 1,439 Times in 1,419 Posts
Default

Are you sure the process takes long enough for the control to appear? Try adding a long sleep delay (of a few seconds for example) as the first thing in the method that sends the e-mail....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old March 28th, 2012, 02:29 PM
Friend of Wrox
Points: 576, Level: 8
Points: 576, Level: 8 Points: 576, Level: 8 Points: 576, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 118
Thanks: 35
Thanked 2 Times in 2 Posts
Default

I tried adding the delay using System.Threading.Thread.Sleep(5000); in SenButton_Click as follows..

protected void SendButton_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string fileName = Server.MapPath("~/App_Data/ContactForm.txt");
string mailBody = File.ReadAllText(fileName);

mailBody = mailBody.Replace("##Name##", Name.Text);
mailBody = mailBody.Replace("##Email##", EmailAddress.Text);
mailBody = mailBody.Replace("##HomePhone##", PhoneHome.Text);
mailBody = mailBody.Replace("##BusinessPhone##", PhoneBusiness.Text);
mailBody = mailBody.Replace("##Comments##", Comments.Text);

MailMessage myMessage = new MailMessage();
myMessage.Subject = "Response from web site. Page: " + PageDescription;
myMessage.Body = mailBody;

myMessage.From = new MailAddress("venum83@sbcglobal.net", "Planet Wrox Contact Form");
myMessage.To.Add(new MailAddress("venum83@sbcglobal.net", "Planet Wrox"));

SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);

Message.Visible = true;
FormTable.Visible = false;

System.Threading.Thread.Sleep(5000);
}
}

But I still do not see the progress indicator in the footer.

Thanks.
Tulsi
Reply With Quote
  #6 (permalink)  
Old March 28th, 2012, 03:50 PM
Imar's Avatar
Wrox Author
Points: 67,755, Level: 100
Points: 67,755, Level: 100 Points: 67,755, Level: 100 Points: 67,755, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,287
Thanks: 66
Thanked 1,439 Times in 1,419 Posts
Default

Very strange. What happens when you take the source from the book (from chapter 19) and move the control from the user control to the master page in that site?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old April 2nd, 2012, 03:36 PM
Friend of Wrox
Points: 576, Level: 8
Points: 576, Level: 8 Points: 576, Level: 8 Points: 576, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 118
Thanks: 35
Thanked 2 Times in 2 Posts
Default

It does work now, but for some strange reason the progress indicator and Please wait now... appear right below the blue bar for the footer.

Is this supposed to happen?

Thank you.

Tulsi
Reply With Quote
  #8 (permalink)  
Old April 2nd, 2012, 03:52 PM
Imar's Avatar
Wrox Author
Points: 67,755, Level: 100
Points: 67,755, Level: 100 Points: 67,755, Level: 100 Points: 67,755, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,287
Thanks: 66
Thanked 1,439 Times in 1,419 Posts
Default

Probably not. Can you post the code for your Master Page as well as the CSS file for the theme you're testing this on?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #9 (permalink)  
Old April 3rd, 2012, 12:26 PM
Friend of Wrox
Points: 576, Level: 8
Points: 576, Level: 8 Points: 576, Level: 8 Points: 576, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 118
Thanks: 35
Thanked 2 Times in 2 Posts
Default

Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="FrontEnd.master.cs" Inherits="MasterPages_MasterPage" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<title></title>

<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>

<body>
<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" ></asp:ScriptManager>
<div id="PageWrapper">
<div id="Header"><a id="A1" href="~/" runat="server"></a></div>

<div id="MenuWrapper">
<asp:Menu ID="Menu1" runat="server" cssclass="MainMenu"
DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
StaticEnableDefaultPopOutImage="False"
onmenuitemclick="Menu1_MenuItemClick">
</asp:Menu>

<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
ShowExpandCollapse="False">
<LevelStyles>
<asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />
</LevelStyles>
<NodeStyle BackColor="White"/>
</asp:TreeView>


<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>

<div id="MainContent">

<asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath><br /><br />
<asp:ContentPlaceHolder ID="cpMainContent" runat="server">

</asp:ContentPlaceHolder>

</div>
<div id="Sidebar">
Select a Theme: <br />
<asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True"
onselectedindexchanged="ThemeList_SelectedIndexCha nged">
<asp:ListItem>Monochrome</asp:ListItem>
<asp:ListItem>DarkGrey</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Vertical" />
<br />
</div>
<div id="Footer">
Footer goes here.
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="PleaseWait">Please Wait... </div>
</ProgressTemplate>
</asp:UpdateProgress>

</div>
</div>
</form>
</body>

</html>

CSS:

*
{
/*
Defines the main font used throughout the entire site
*/
font-family: Arial, Sans-Serif;
}

body
{
/*
Clears white space around the body and gives it a dark gray color.
*/
margin: 0;
background-color: #cccccc;
}

a
{
/*
Clears the underline on normal links, and gives them a purple text color.
*/
text-decoration: none;
color: #4628C4;
}

a:hover
{
/*
Underlines links when the user hovers the mouse over them.
*/
text-decoration : underline;
}

h1
{
/*
Makes h1 elements smaller than their browser default.
*/
font-size : 20px;
}

h2
{
/*
Gives h2 elements a different background color and size,
and adds a bit of margin at the top to create room between the heading and the preceding element.
*/
font-size : 14px;
color : #7773A1;
margin-top : 10px;
}

img
{
border: none;
}

#PageWrapper
{
/*
Sets the total width for the entire page. Also sets the background-color
which is used to fill the background of the Sidebar in case the MainContent block is taller than the Sidebar.
Uses margin: auto to center the entire page in the middle of the browser's window.
*/
width: 844px;
background-color: #7773A1;
margin: auto;
}

#Header
{
/*
Gives the header the same width as the PageWrapper. The height creates some room for the logo
that is set with the background-image.
*/
background-image: url(Images/Header.jpg);
width: 844px;
height: 86px;
}

#Header a
{
/*
The #Header a is a link nested in #Header. It provides a link back to the homepage.
The size of the link is the same as the header, so the entire header is clickable.
*/
width: 844px;
height: 86px;
display: block;
}

#MenuWrapper
{
/*
The menu spans the page width, right below the header.
At the top and left a few pixels padding is applied to create some room.
*/
background-image: url(Images/MenuBackground.jpg);
width: 827px;
height: 36px;
padding-top: 7px;
padding-left: 17px;
}

#MenuWrapper a
{
/*
Links in the Menu are white. This gets overriden by styles in chapter 7.
*/
color: #fff;
}

.MainMenu
{
/*
The Menu gets a white border on all four sides.
*/
border: 1px solid white;
width: 814px;
height: 19px;
background-color : #cccccc;
}

.MainMenu ul li
{
/*
Gives the four menu items in the main menu a width of 200px each
*/
width: 200px;
}

ul.level1
{
/* Defines the appearance of the main menu items */
font-size: 14px;
font-weight: bold;
height: 19px;
line-height: 19px;
}

ul.level1 .selected
{
/* Defines the appearance of active menu items */
background-color: #BCD1FE;
}

a.level1
{
/* adds some white space to the left of the main menu item text */
margin-left: 5px;
}

a.level2
{
/* Defines the appearance of the sub menu items */
background-color: #cccccc;
padding-left: 8px;
}

a.level1:hover, a.level2:hover
{
/* Defines the hover style for the main and sub items */
background-color: #BCD1FE;
}


#MainContent
{
/*
Defines the main content area. The #MainContent element has a minimum height of 500 pixels, but can grow if necessary.
The font-size is 80% of its parent element, which in this case comes down to 80% of the font
the user has specified as the default font in the browser.
*/
font-size: 0.8em;
width: 659px;
border-left: 1px solid white;
border-right: 2px solid white;
float: left;
background-color: #e1e1e1;
min-height: 500px;
padding: 10px;
}

#Sidebar
{
/*
The Sidebar is positioned to the right of the MainContent area. It gets the same font-size as #MainContent
and gets a background image called Sidebar.jpg. To ensure the image is visible in (most) browsers
on a small page, the element gets a minimum height of 500px. This is ignored by IE 6.
*/
font-size: 0.8em;
color: White;
background-image: url(Images/Sidebar.jpg);
background-repeat: no-repeat;
background-color: #7773A1;
width: 142px;
min-height: 500px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 20px;
float: left;
}

#Footer
{
/*
The footer is positioned below all other content (yet still within PageWrapper).
clear: both is used to clear the impact of the float properties used for #MainContent and #Sidebar.
*/
width: 844px;
clear: both;
height: 37px;
background-color : #BCD1FE;
color: White;
text-align: center;
font-size: 0.7em;
font-weight: bold;
line-height: 37px;
}

.Introduction
{
font-style: italic;
color: #3e3e3e;
}

.MyButton
{
color: White;
}

.ErrorMessage
{
color:Red;
}

.PleaseWait
{
height:32px;
width:500px;
background-image: url(Images/PleaseWait.gif);
background-repeat: no-repeat;
padding-left: 40px;
line-height: 32px;
}
Reply With Quote
  #10 (permalink)  
Old April 3rd, 2012, 03:01 PM
Imar's Avatar
Wrox Author
Points: 67,755, Level: 100
Points: 67,755, Level: 100 Points: 67,755, Level: 100 Points: 67,755, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,287
Thanks: 66
Thanked 1,439 Times in 1,419 Posts
Default

I think I found it....

Code:
 
#Footer
{
  ...
  height: 37px;
  ...
  line-height: 37px;
}
The line-height causes the line of text in the footer to take up all the space, forcing the image outside of the footer. Either increase the height, remove the line-height or place the please wait div next to another div withe footer text and float them side by side in the main footer area. E.g.:

Code:
<div id="Footer">
  <asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
      <div class="PleaseWait">
        Please Wait...
      </div>
    </ProgressTemplate>
  </asp:UpdateProgress>
  <div class="FooterText">
    Footer goes here.</div>
</div>
with this CSS:

Code:
 
#Footer
{
  width: 844px;
  height: 32px;
  clear: both;
  background-color: #BCD1FE;
  color: White;
  text-align: left;
  font-size: 0.7em;
  font-weight: bold;
}
.PleaseWait
{
  background-image: url(Images/PleaseWait.gif);
  background-repeat: no-repeat;
  width: 100px;
  float: left;
  height: 32px;
  line-height: 32px;
  padding-left: 40px;
}
.FooterText
{
  float: left;
  line-height: 32px;
  width: 704px;
}
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 10, listing 10-10-app kiwibrit BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 2 August 18th, 2009 05:21 AM
Chapter 10 JimSchubert BOOK: Ruby on Rails for Microsoft Developers 1 May 18th, 2009 12:35 AM
Chapter 10 czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 March 29th, 2005 09:35 AM
Chapter 10 columbiasmiles JSP Basics 0 May 17th, 2004 09:09 PM



All times are GMT -4. The time now is 11:08 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.