Monday, March 26, 2012
Pass the name into HTM file
I have an HTML which I load as string and send it via MailMessage class.
oMailMessage.Body = cHTMLString
Before it is sent as e-mail I need to pass the HTM file the user
First and Last in the first line.
It is a form where the user enters his/her details and then it is
e-mailed the user with the HTM file within the e-mail's body.
It would start like:
Hi Steve Smith,
How can I embed the First and Last name of the user into the htm file?
Thanks,
Joe"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:ug8bTf5XHHA.4220@.TK2MSFTNGP03.phx.gbl...
> I have an HTML which I load as string and send it via MailMessage class.
> oMailMessage.Body = cHTMLString
> Before it is sent as e-mail I need to pass the HTM file the user
> First and Last in the first line.
> It is a form where the user enters his/her details and then it is
> e-mailed the user with the HTM file within the e-mail's body.
> It would start like:
> Hi Steve Smith,
> How can I embed the First and Last name of the user into the htm file?
oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;
Hi Mark,
Thanks for your reply. But how do I keep the Verdana font of that embeded
string?
Also the semi column was a problem and got an err which is: Character is not
valid
oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;
Thanks,
Joe
"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:OjyJY8$XHHA.992@.TK2MSFTNGP04.phx.gbl...
> Thanks for your reply. But how do I keep the Verdana font of that embeded
> string?
oMailMessage.IsBodyHtml = true;
> Also the semi column was a problem and got an err which is: Character is
> not valid
Ah - I assumed you were using C#...
If you're using VB.NET, you'll (probably) need to do something like:
oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString
oMailMessage.IsBodyHtml = True
Hi Mark,
Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
The fornt of the below is not the same any more:
oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
What I did is: In the first line of the HTM file I did as follows:
Hi {First Name} {Last Name},
Then:
cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)
cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)
Thanks,
Joe
Hi,
Actually solution was simple just add font tag in html
like
oMailMessage.Body = "Hi <font face=verdana size=10>" & txtFirstName.Text & "
" & txtLastName.Text & ""
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString
oMailMessage.IsBodyHtml = True
it will definately work
cheers
Chetan Chaphekar
"JoeP" wrote:
> Hi Mark,
> Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
> The fornt of the below is not the same any more:
> oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
> vbCrLf & vbCrLf
> What I did is: In the first line of the HTM file I did as follows:
> Hi {First Name} {Last Name},
> Then:
> cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)
> cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)
> Thanks,
> Joe
"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.com> wrote in
message news:F8362751-1E99-4F82-B043-D3D44F0A120F@.microsoft.com...
> it will definately work
As far as you are concerned, it will definitely work...
However, you need to think quite carefully about sending HTML emails...
Most modern mail software can be configured not only to strip out all HTML
content, but also to reject emails with HTML content...
Depending on how paranoid / security-conscious your recipients are, they
might never even see your emails if you send them in HTML format...
Hi Mark,
The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code. Otherwise the user will need to
copy the URL into the Browser. Not that productive.
Regards,
Joe
"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:OCnYUOPYHHA.3268@.TK2MSFTNGP04.phx.gbl...
> The problem is that I have some links in that HTM file. So I how can I
> provide those links without any HTM code.
You can't...
> Otherwise the user will need to copy the URL into the Browser.
That's true.
> Not that productive.
Even less productive if the email gets rejected by the user's mail client
before the user even has a chance to see it...
Your call...
Hi Joep,
What mark has said is right but also consider the percentage of receipient
who has this kind of settings. almost all sites who send newsletter to the
subscriber use HTML code in their email.
cheers
chetan chaphekar
"JoeP" wrote:
> Hi Mark,
> The problem is that I have some links in that HTM file. So I how can I
> provide those links without any HTM code. Otherwise the user will need to
> copy the URL into the Browser. Not that productive.
> Regards,
> Joe
>
>
Pass the name into HTM file
I have an HTML which I load as string and send it via MailMessage class.
oMailMessage.Body = cHTMLString
Before it is sent as e-mail I need to pass the HTM file the user
First and Last in the first line.
It is a form where the user enters his/her details and then it is
e-mailed the user with the HTM file within the e-mail's body.
It would start like:
Hi Steve Smith,
How can I embed the First and Last name of the user into the htm file?
Thanks,
Joe
"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:ug8bTf5XHHA.4220@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
I have an HTML which I load as string and send it via MailMessage class.
oMailMessage.Body = cHTMLString
>
Before it is sent as e-mail I need to pass the HTM file the user
First and Last in the first line.
>
It is a form where the user enters his/her details and then it is
e-mailed the user with the HTM file within the e-mail's body.
>
It would start like:
>
Hi Steve Smith,
>
How can I embed the First and Last name of the user into the htm file?
oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;
Hi Mark,
Thanks for your reply. But how do I keep the Verdana font of that embeded
string?
Also the semi column was a problem and got an err which is: Character is not
valid
oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;
Thanks,
Joe
"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:OjyJY8$XHHA.992@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
Thanks for your reply. But how do I keep the Verdana font of that embeded
string?
oMailMessage.IsBodyHtml = true;
Quote:
Originally Posted by
Also the semi column was a problem and got an err which is: Character is
not valid
Ah - I assumed you were using C#...
If you're using VB.NET, you'll (probably) need to do something like:
oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString
oMailMessage.IsBodyHtml = True
Hi Mark,
Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
The fornt of the below is not the same any more:
oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
What I did is: In the first line of the HTM file I did as follows:
Hi {First Name} {Last Name},
Then:
cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)
cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)
Thanks,
Joe
Hi,
Actually solution was simple just add font tag in html
like
oMailMessage.Body = "Hi <font face=verdana size=10>" & txtFirstName.Text & "
" & txtLastName.Text & "</font>"
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString
oMailMessage.IsBodyHtml = True
it will definately work
cheers
Chetan Chaphekar
"JoeP" wrote:
Quote:
Originally Posted by
Hi Mark,
>
Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
The fornt of the below is not the same any more:
>
oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
>
What I did is: In the first line of the HTM file I did as follows:
Hi {First Name} {Last Name},
>
Then:
cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)
>
cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)
>
Thanks,
>
Joe
"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.comwrote in
message news:F8362751-1E99-4F82-B043-D3D44F0A120F@.microsoft.com...
Quote:
Originally Posted by
it will definately work
As far as you are concerned, it will definitely work...
However, you need to think quite carefully about sending HTML emails...
Most modern mail software can be configured not only to strip out all HTML
content, but also to reject emails with HTML content...
Depending on how paranoid / security-conscious your recipients are, they
might never even see your emails if you send them in HTML format...
Hi Mark,
The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code. Otherwise the user will need to
copy the URL into the Browser. Not that productive.
Regards,
Joe
"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:OCnYUOPYHHA.3268@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code.
You can't...
Quote:
Originally Posted by
Otherwise the user will need to copy the URL into the Browser.
That's true.
Quote:
Originally Posted by
Not that productive.
Even less productive if the email gets rejected by the user's mail client
before the user even has a chance to see it...
Your call...
Hi Joep,
What mark has said is right but also consider the percentage of receipient
who has this kind of settings. almost all sites who send newsletter to the
subscriber use HTML code in their email.
cheers
chetan chaphekar
"JoeP" wrote:
Quote:
Originally Posted by
Hi Mark,
>
The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code. Otherwise the user will need to
copy the URL into the Browser. Not that productive.
>
Regards,
>
Joe
>
>
>
"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.comwrote in
message news:85AB981F-934B-453F-A698-D79B7C5CF3B9@.microsoft.com...
Quote:
Originally Posted by
but also consider the percentage of receipient who has this kind of
settings.
Increasing all the time...
Quote:
Originally Posted by
almost all sites who send newsletter to the subscriber use HTML code in
their email.
More and more now give their recipients the option of receiving such
correspondence either in plain text or HTML...
pass through value of DropDownList ListItem into a string
I'm building an email form that uses a DropDownList to select the e-mail address via alias. Here is a portion of the control:
<asp:DropDownList id="ddlRecipient" CssClass="text-blue" AutoPostBack="true" runat="server">
<asp:ListItem Value="none" Selected="true">Please select from this list.</asp:ListItem>
<asp:ListItem Value="mornings">the morning show</asp:ListItem>
<asp:ListItem Value="news">News - newscasts, stories, comments</asp:ListItem>
</asp:DropDownList
Here is the code I am supposedly using to pass through the value:
Sub SendMe ()
Dim ddlRecipient As String
Dim ddlRecipientEmail As String = ddlRecipient & "@dotnet.itags.org.mydomain.com"
Response.Write(ddlRecipientEmail & " -- this is the email address you just sent")
End Sub
(The Response.Write line will be replaced by my email generation code, and I will use ddlRecipientEmail as the "from" field.)
However, all I get from the Response.Write is:
@dotnet.itags.org.mydomain.com -- this is the email address you just sent
So it's not passing through the value. How do I get it to do that?
Also, I'm going to do an If/Then/Else statement that, if "none" is the value, you get a popup and the program stops running. Anyone got a quick way to do that?
Appreciate the help.
ddlRecipient.SELECTEDVALUE
I actually just found that and it is working now.Thank you.
Curt_C:
ddlRecipient.SELECTEDVALUE
Saturday, March 24, 2012
pass variable between webpage
pages, and user controls , any examples
-
dolla
----------------------
Posted via http://www.codecomments.co
----------------------Hi Dollar,
There are various ways in which ASP.NET helps you to pass information
from one page to another, it basically depends on your application.
In general, the applications use Session state to pass variables.
You can refer to the following link for complete details:
[State Management Recommendations]
http://msdn.microsoft.com/library/d...StateOption.asp
As for user controls, you can have public properties for the user control
which can be accessed by any page and also they will retain their values in
between
server round trips.
HTH
Mona[Grapecity]
"dollar" <dollar.1pp11p@.mail.codecomments.com> wrote in message
news:dollar.1pp11p@.mail.codecomments.com...
> I want to ask what is the best way to pass variable between asp.net web
> pages, and user controls , any examples?
>
> --
> dollar
> ----------------------
> Posted via http://www.codecomments.com
> ----------------------
Wednesday, March 21, 2012
passing a GUID in the querystring
Dim myGUID as GUID
GUID = Request.QueryString("myGUID")
It won't run, and says that a value type of string cannot be converted to a GUID. I can't retype myGUID as a string, because I use it in a SQL Server Database call...It yells at me if try to do a query with it in there.
Am I doing something wrong? or is there just no way to pass a GUID through the querystring?
ThanksIf you pass the value on the url it will be in a string format. The following worked for me. Maybe this will help.
select * from table1 where uniqueID = cast('{5BEEAA61-394B-44F6-9AC8-A6EA5FC99490}' as uniqueidentifier)
You need to do the following:
Dim MyGuid As Guid = New Guid(Request.QueryString("myGuid"))
Passing a reference to a User Control to a class in ASP2.0
I'm trying to pass a reference to a user control to a class. The user
control exposes its elements via properties. When I inspect parameter (user
control is passed to class using "this") I can see it's data in debugger,
but no way to access it in class code. I have tried casting to control
type, but it says type or namespace can't be found. Any ideas?
Charliedefine a base class the control inherits from that defines the properties,
or better yet, have the control implement an interface with the desired
properties, then cast the control to the interface in the class.
-- bruce (sqlwork.com)
"Charlie@.CBFC" <fineblumcb@.verizon.net> wrote in message
news:Oq3%23puwXGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Hi:
> I'm trying to pass a reference to a user control to a class. The user
> control exposes its elements via properties. When I inspect parameter
> (user control is passed to class using "this") I can see it's data in
> debugger, but no way to access it in class code. I have tried casting to
> control type, but it says type or namespace can't be found. Any ideas?
> Charlie
>
Passing a reference to a User Control to a class in ASP2.0
I'm trying to pass a reference to a user control to a class. The user
control exposes its elements via properties. When I inspect parameter (user
control is passed to class using "this") I can see it's data in debugger,
but no way to access it in class code. I have tried casting to control
type, but it says type or namespace can't be found. Any ideas?
Charliedefine a base class the control inherits from that defines the properties,
or better yet, have the control implement an interface with the desired
properties, then cast the control to the interface in the class.
-- bruce (sqlwork.com)
"Charlie@.CBFC" <fineblumcb@.verizon.net> wrote in message
news:Oq3%23puwXGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Hi:
> I'm trying to pass a reference to a user control to a class. The user
> control exposes its elements via properties. When I inspect parameter
> (user control is passed to class using "this") I can see it's data in
> debugger, but no way to access it in class code. I have tried casting to
> control type, but it says type or namespace can't be found. Any ideas?
> Charlie
Friday, March 16, 2012
Passing a variable to another page
next page...
How can I do this via that method that I see in other sites that the url
goes like this:
http://www.google.com.br/search?hl=pt-BR
[]s...Look up the concept of querystrings
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Ricardo" <r_luceac@.hotmail.com> wrote in message
news:%23IPFidjDFHA.2632@.TK2MSFTNGP12.phx.gbl...
> How can I navigate to another page via a button, and pass a variable to
this
> next page...
> How can I do this via that method that I see in other sites that the url
> goes like this:
> http://www.google.com.br/search?hl=pt-BR
>
> []s...
>
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetbips.com/displayarticle.aspx?id=79
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Ricardo" <r_luceac@.hotmail.com> wrote in message
news:%23IPFidjDFHA.2632@.TK2MSFTNGP12.phx.gbl...
> How can I navigate to another page via a button, and pass a variable to
> this
> next page...
> How can I do this via that method that I see in other sites that the url
> goes like this:
> http://www.google.com.br/search?hl=pt-BR
>
> []s...
>
Passing a variable to another page
next page...
How can I do this via that method that I see in other sites that the url
goes like this:
http://www.google.com.br/search?hl=pt-BR
[]s...Look up the concept of querystrings
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"Ricardo" <r_luceac@.hotmail.com> wrote in message
news:%23IPFidjDFHA.2632@.TK2MSFTNGP12.phx.gbl...
> How can I navigate to another page via a button, and pass a variable to
this
> next page...
> How can I do this via that method that I see in other sites that the url
> goes like this:
> http://www.google.com.br/search?hl=pt-BR
>
> []s...
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetbips.com/displayarticle.aspx?id=79
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Ricardo" <r_luceac@.hotmail.com> wrote in message
news:%23IPFidjDFHA.2632@.TK2MSFTNGP12.phx.gbl...
> How can I navigate to another page via a button, and pass a variable to
> this
> next page...
> How can I do this via that method that I see in other sites that the url
> goes like this:
> http://www.google.com.br/search?hl=pt-BR
>
> []s...