Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 1st, 2009, 10:33 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Email counter not working !!!

Goal : Developing and ASP.NET 2.0 based mail sending application for sending mass emails (whihch could have attachements also so need a file uploader on the aspx page), which will be send one by one, i.e no CC and BCC.The aspx page should be able to display number of emails successfully send for any given moment.
Approch Implemented : I am using a page level variable which get incremented on each successful mail send. This variable is passed to a local WebService( WebService is inside the application). From the aspx page I am calling another WebService which holds the value of this counter variable along with current time using Javascript and AJAX(Script manager , Services , ServiceReference) every 5 seconds and updating a div tag on the page with the value.
Issue : The counter and time is working fine till the page is not posted back. As soon as i provide the necessary valuesfor the mails ( body text , contacts list(text file based), from address etc) and click a button to post the data to server for processing the counter stops, but the mails keep getting sended, the counter once again starts working as soon as the job of sending mails finishes That is the page is fully posted back.

Kindly suggest me a solution and it would be gr8 if a small working code for the same is provided.

Following is the aspx page I am using :
Code:
<style type="text/css">
function GetSuccessMail(param)
        {  
            var testBool = param;
            NavatarService.MailsSent.SuccessMails(testBool, OnWSRequestComplete,OnWSRequestFailed);               
        }
        
        function OnWSRequestComplete(results)
        {
            if (results != null)
            {
                var lbl = document.getElementById('SuccessDiv');
                lbl.style.fontWeight = 'bold';
                lbl.style.color = 'lime';
                lbl.style.visibility = 'visible';
                lbl.style.width = '100%';
                lbl.value = results;             
            }
        }
        
        function OnWSRequestFailed(error)
        {              
            alert("Error getting hints");
        }
        
        
        setInterval ( "GetSuccessMail(true)", 1000 );
       
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" >
            <Services>
                <asp:ServiceReference Path="~/MailsSent.asmx" />
            </Services>     
        </asp:ScriptManager>
<div id="container">
<div id="mainpicture">
<table>
<tr>
    <td>
        <img src="images/key_points_15.jpg" border="0" alt="Quotation" style="border:0px;" />
    </td>
</tr>
<tr>
    <td>
        <input id="SuccessDiv" type="text" style="width: 100%px; height: 13px;border:0px;visibility:hidden;text-align:center;"/>
    </td>
</tr>
</table>
</div>
<div id="bodytext" style="left: 191px; top: 283px">
<span class="headline">Navatar mass mailer.</span>
<br /><br />
<table border="0" cellpadding="2" cellspacing="1">
    <tr bgcolor="white">
  <td valign="top" align="right">
   <label for="txtFrom"></label><font class="reqImage"></font>
  </td>
  <td valign="top">
            <asp:Label ID="lblSuccessMails" runat="server" Text="" Visible="false" Font-Size="Larger" ForeColor="BlueViolet"></asp:Label>
  </td>
 </tr>
    <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="txtFrom">From Address:</label><font class="reqImage">*</font>
  </td>
  <td valign="top">
   <asp:TextBox ID="txtFrom" runat="server" ToolTip="If 'From Address' is not provided 'UserId' will be used as From Address."></asp:TextBox>
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td width="114" align="right" valign="top">
   <label for="first_name">Subject:</label> <font class="reqImage">*</font>
  </td>
  <td width="292" valign="top">
   <asp:TextBox ID="txtMailSubject" runat="server"></asp:TextBox>
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="last_name">Excel Contacts:</label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
   <asp:FileUpload ID="toFileUpload" runat="server" />&nbsp;
  </td>
 </tr>
    <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="last_name">Message Body:</label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
   <asp:FileUpload ID="msgBodyFileUpload" runat="server" />&nbsp;
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="last_name">Add alternate text? </label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
            <asp:CheckBox ID="chkBoxAltText" runat="server" onclick="EnableAlternateText();"/>
  </td>
 </tr>
  <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <span id="altText" style="visibility:hidden;"><label for="last_name">Alternate Text:</label> <font class="reqImage">*</font></span>
  </td>
  <td valign="top">
   <asp:FileUpload ID="FileUploadAlterText" runat="server"  style="visibility:hidden;"/>&nbsp;
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="last_name">Importance:</label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
            <asp:RadioButtonList ID="rdoBtn" runat="server" RepeatDirection="Horizontal" Width="229px">
            <asp:ListItem Text="High" Value="High"></asp:ListItem>
            <asp:ListItem Text="Normal" Value="Normal" Selected="True"></asp:ListItem>
            <asp:ListItem Text="Low" Value="Low"></asp:ListItem>
            </asp:RadioButtonList>
   &nbsp;
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="phone">UserId:</label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
   <asp:TextBox ID="txtUserId" runat="server"></asp:TextBox>
  </td>
 </tr>
    <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="phone">Password:</label> <font class="reqImage">*</font>
  </td>
  <td valign="top">
   <asp:TextBox ID="txtPwd" runat="server" TextMode="Password"></asp:TextBox>
  </td>
 </tr>
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <font class="reqImage"></font>
  </td>
  <td valign="top">
      <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
            <br /><br />
            <asp:Button ID="btnSend" runat="server" Text="Send Mail" OnClick="btnUpload_Click" OnClientClick="SetCheckBox();"/>
            <br /><br />
            <font class="reqImage">*</font> Required fields
            <br />
        </td>
 </tr> 
 
 <tr bgcolor="white" height="30">
  <td valign="top" align="right">
   <label for="phone"></label> <font class="reqImage"></font>
  </td>
  <td valign="top">
            <asp:RequiredFieldValidator ID="rfvMailSubject" runat="server" ErrorMessage="Please enter subject for the mail." ControlToValidate="txtMailSubject"></asp:RequiredFieldValidator><br />
            <asp:RequiredFieldValidator ID="rfvTxtUserId" runat="server" ErrorMessage="Please enter userId." ControlToValidate="txtUserId"></asp:RequiredFieldValidator><br />
            <asp:RequiredFieldValidator ID="rfvTxtPwd" runat="server" ErrorMessage="Please enter password." ControlToValidate="txtPwd"></asp:RequiredFieldValidator>
   </td>
 </tr>
</table>
</div>
</div>
 </form>
</body>
</html>
  #2 (permalink)  
Old February 1st, 2009, 12:48 PM
jminatel's Avatar
Wrox Staff
Points: 18,940, Level: 59
Points: 18,940, Level: 59 Points: 18,940, Level: 59 Points: 18,940, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2003
Location: Indianapolis, IN, USA.
Posts: 1,945
Thanks: 73
Thanked 139 Times in 101 Posts
Default

I moved yout post to this forum, I don't think it was about the book where you posted it. Also, you might try editing your post and wrapping your long code lines near the end so it's easier to read.
__________________
Jim Minatel
Associate Publisher, WROX - A Wiley Brand
Did someone here help you? Click on their post!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Counter tp194 Javascript 1 September 2nd, 2004 08:02 AM
Hit Counter mateenmohd HTML Code Clinic 7 September 28th, 2003 07:22 AM
counter Adam H-W Classic ASP Basics 15 August 15th, 2003 11:18 AM



All times are GMT -4. The time now is 05:18 AM.


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