.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

HTML Email & Gridviews

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

I have a timesheet app on our intranet where users enter the time for projects worked on in a gridview.  The gridview is included in an html email which gets sent to the users' lead.  If the lead approves, a copy should get shot to the appropriate staff.  I can not figure out how to call the gridview in the lead's email.  Any help is greatly appreciated.  See sample code below:

            .From = New MailAddress(Session("uEMail"), Session("uName"))
            .IsBodyHtml = True
            .Subject = "Timesheet for week ending (" & txtPeriod.Text & ") from " & Session("uName")
            .Body = "<html><body>"
            .Body = "<table valign=top border=0 width=500px>"
            .Body = .Body & "<tr><td bgcolor=#30297A colspan = ""2"" align = ""left"" valign = ""middle""><font color=#F4D331 size=6px><b>" & strForm & " for " & txtPeriod.Text & "</b></font></td></tr>"
            .Body = .Body & "<tr><td width=40%>Submitted By: </td><td width=60%>" & txtSubmittedBy.Text & "</td>

View Complete Post

More Related Resource Links

Send HTML email with banner inside


Hi all,

I want to send html emails with one promo-banner inside. Have a look at my code... I try but with no success.


            Dim strFrom, strTo, strSubject, strBody As String
            Dim myMessage As MailMessage
            Dim mySmtpClient As SmtpClient
            strFrom = "SENDER<test@example.com>"
            strTo = Session("eemaill")
            strSubject = "HELLO THERE!"
            strBody = "HELLO THIS IS MY MSG<br />" + _
            " <script type='text/javascript'> var ai = 899; var rc = 40; var rt= 2; var rc_width = 724; var rc_height = 90; </script>" + _
            " <script type='text/javascript' src='http://assets.example.com/s/ads.js'></script><br /><br />" + _
            "<b>THANK YOU</b>"
            myMessage = New MailMessage(strFrom, strTo, strSubject, strBody)
            myMessage.IsBodyHtml = True
            mySmtpClient = New SmtpClient("mail.example.com")




Thank you

putting carriage return/line feed in non-HTML email text

Using vb.net/asp.net 2005I am trying to create a string message for an email that I am sending out from my asp.net page like so: For Each dr In dtDataTable.Rows strMessage = strMessage & vbCrLf & vbCrLf & Environment.NewLine & dr.Item("UserName") & Environment.NewLine Next so I am looping through a datatable and getting each name from each row, that is working well but when I get the email it appears in my inbox with all the names mashed together, you see I am trying both vbcrlf and newline but looks like neither is workingdoes anyone know what I'm doing wrong?

Email template from HTML


 Hello All,

is there a way to use a HTML template for a mail function.

a users fills in some info, than a email template (html file) is filled with parameters and than send to the receiving person.


Any help would be aprreciated.







sending muliple html pages in single email


want to send muliple html pages in a email in vb.net

Sending an Email in HTMl


Hi all

In the following HTML I have 3 input boxes Name,Email,Subject and a textbox for the message.

Now how can I send the text entered to a specified email address when the user sellects the send button.

I would realy apreciated if you know of any document that would explain this, I tried googleing it I found lots but it wasn't well explained.



<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Contacts.aspx.vb" Inherits="Contacts" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div class="contactdiv">

<div id="divlblname">
<asp:Label ID="lblname" runat="server">Name</asp:Label>
<div id="divtxtname">
    <input id="txtname"  size="35px" type="text" /><br />

<div id="divlblmail">
    <asp:Label id="lblemail" runat="server">Email</asp:Label

Retreive A Label From Gridview Then Email It In HTML Form


I have a gridview with a button on the end of each row... When the button is clicked I need to access information on that specific row then send the information via email... So for example 1 row will have a binded label firstname "Chris", when the button is ticked for that row it needs to send the value "Chris" in an email... Im just wondering how this can be done?

Firstname label in gridview:

            <asp:Label ID="Firstnamelbl" runat="server" Text='<%# Eval("Firstname") %>'></asp:Label>

Button at the end of each row:

                    <asp:Button ID="Button1" Runat="server" Text="Send" OnClientClick="Button1_Click" />

Workflow Email - HTML customization


I'm trying to customize a simple workflow email that's pulling data from an Infopath form with a repeating table. In order for the data to be readable, it needs to be put in a table with columns and rows. I've tried to use HTML code to achieve this in SharePoint Designer 2010 but when the email goes out, it's just the code. I'm not familiar with HTML so I don't know what I'm doing wrong. Here's the code that I've pasted into the body of the "Define Email Message" window (except where it says "lookup" I actually added fields from the list as a "String"...not sure why it won't let me copy and paste them):

<h3>Date:</h3><h3>Clinician:</h3><table border="2"><tr><td>Location</td><td>Species</td><td>LC#</td><td>Comment</td><td>Vet</td></tr><tr><td>lookup</td><td>lookup</td><td>lookup</td><td>lookup</td><td>lookup</td></tr></table><h3>Upcoming Procedures</h3><table border="2"><tr><td>Species</td><td>Date</td><td>Description</td></tr><tr><td>lookup</td><td>lookup</td><td>lookup</td></tr></table><h3>Shipment Statu

Generating HTML email with mailto:


How do I generate an HTML email when the user clicks on a mailto: link?

SPD Workflow error only when I add HTML to the email


I've created similar emails before with sharepoint designer.

When I add HTML to format the email in my workflow, the workflow fails. but if I remove it, it completes without a problem.

ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

Rendering ASP.NET Script References into the Html Header

One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.

PrintPocketCE Print Pocket Excel, Pocket Word and email files

Version 3.560 (May 15, 2009):

Important bug fix: a slight difference in how some devices create fonts was causing a few devices to have significantly longer print times for large print jobs.

Adjusted PocketJet printer paper feed commands

Other minor fixes and enhancements.

Version 3.559 (Mar 5, 2009):

Added support for Martel MCP78xx printers

Version 3.558 (Aug 20, 2008):

Added support for Martel MCP78xx printers

Version 3.557 (June 27, 2008):

Fixed error in Canon printer support

Fixed COM0 port selection

Version 3.556 (June 15, 2008):

Added support for Brother MW-260

Added support for Sato MB400

Version 3.555 (Aug 8, 2007):

Added support for Pentax RuggedJet 3 and RuggedJet 4 printers

Changed Epson TM-P60 support to maximum page width of 1200 dots

Version 3.551 (Aug 1, 2006):

Added Peripheral Nomad printer support

Version 3.550 (Mar 23, 2006):

Added Panasonic JT-H200PR printer support

Added Pocket Spectrum printer support

Fixed problem with WM5.0 "inverted image" problem

Send Email from SQL Server Express Using a CLR Stored Procedure

One of the nice things about SQL Server is the ability to send email using T-SQL. The downside is that this functionality does not exist in SQL Server Express. In this tip I will show you how to build a basic CLR stored procedure to send email messages from SQL Server Express, although this same technique could be used for any version of SQL Server.

If you have not yet built a CLR stored procedure, please refer to this tip for what needs to be done for the initial setup.

Getting value of Html.TextBoxFor(m => m.name)


Hi All,

I am new to Asp.net MVC 2. I am unable to get value for Html.TextBoxFor(m = > m.name) in view. I can get this value in Controller.

How to get this value in view.

Please help.

Embed Youtube inside Ajax Html Editor- problem



When inserting a simple embed of youtube inside the ajax editor, on firefox and chrome problems occur. On the other hand on internet explorer 8 everything works fine. I found this solution http://www.nopcommerce.com/boards/t/4228/bug-in-ajax-html-editor.aspx . 

My question is where do I find the DesignPanel.pre.js ?


Roderick Vella

Re-positioning an HTML container with javascript onresize with a Master page.


I have an HTML <div> container that I float to the right of a gridview.  When the browser window is maximized, it looks fine.  When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.

If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.

What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.

I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page.  I think I'm having a very "thick" week...

- Tinker


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend