CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2008
    Posts
    47

    UpdateProgress not working

    Hi
    I am using asp.net 2.0 - the following is the code for sending email with attachment - I placed the HTML portion in an UPdate panel
    everything ok, mail succesfully delivered to the recipient-
    BUT PROBLEM IS THE UPDATEPROGRESS CONTROL IS NOT WORKING AT ALL
    WHAT WENT WRONG

    .progress2
    {
    border-color:green;
    position:absolute;
    top:165px;
    left:640px;
    width:40px;
    height:40px;
    padding-left:1px;
    padding-right:1px;
    padding-bottom:1px;
    z-index:1
    }

    <%@ Page Language="VB" %>
    <%@ Import namespace="System.Net.Mail" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    '!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS

    'Make sure a file has been uploaded
    If String.IsNullOrEmpty(FileUpload1.FileName) OrElse FileUpload1.PostedFile Is Nothing Then
    Throw New ApplicationException("Egad, a file wasn't uploaded... you should probably use more graceful error handling than this, though...")
    End If

    Const ToAddress As String = "sheriefes@ascorpuae.com"

    '(1) Create the MailMessage instance
    Dim mm As New MailMessage("test@ascorpuae.com", ToAddress)

    '(2) Assign the MailMessage's properties
    mm.Subject = "from PHP"
    mm.Body = txtBody.Text
    mm.IsBodyHtml = False


    '(3) Create the SmtpClient object
    Dim smtp As New SmtpClient

    '4: 'Attach the file
    mm.Attachments.Add(New Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName))

    '(5) Send the MailMessage (will use the Web.config settings)
    smtp.Timeout = 200000 'in milli seconds
    smtp.Send(mm)
    Label1.Text = "Message Sent" : upTenant.Update()
    End Sub
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    <link href="progress.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager2" runat="server" EnablePartialRendering=true></asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="FALSE"
    AssociatedUpdatePanelID="upTenant">
    <ProgressTemplate>
    <asp:Image runat="Server" ID="progreesImage" cssClass="progress2" ImageUrl="~/images2/clock.gif"/>
    </ProgressTemplate>
    </asp:UpdateProgress>

    <asp:UpdatePanel ID="upTenant" runat="server" UpdateMode=Conditional ChildrenAsTriggers=true>
    <ContentTemplate>
    <Triggers><asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click"/></Triggers>

    <asp:TextBox ID="txtBody" runat="server" Height=50 Width="405px"></asp:TextBox><br>
    <asp:FileUpload ID="FileUpload1" runat="server" /></div><br>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="send" />
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    </ContentTemplate></asp:UpdatePanel>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Oct 2008
    Posts
    47

    Re: UpdateProgress not working

    upon first glance it looks like the needle in the haystack you are looking for is a missing ; right after z index in your css

    .progress2
    {
    border-color:green;
    position:absolute;
    top:165px;
    left:640px;
    width:40px;
    height:40px;
    padding-left:1px;
    padding-right:1px;
    padding-bottom:1px;
    z-index:1
    }

    Larry
    -----------------------------
    disclaimer: although I work for Microsoft as an Evangelist, my opinions (and occasional errors) are mine and not to be misconstrued as Microsoft's

    Happy Developing!
    Last edited by tattooedscorpdc; October 7th, 2008 at 03:08 PM. Reason: disclaimer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured