Showing posts with label working. Show all posts
Showing posts with label working. Show all posts

Monday, March 26, 2012

StringBuilder AppendLine dont print Line breaks in my emails!

Hello... I'm working with StringBuilder to create a message to send via text email.

My methos is:

StringBuilder retorno = new StringBuilder();

retorno.AppendLine ( "A lot of text 1" );
retorno.AppendLine ( "A lot of text 2" );

return retorno.ToString() ;

Well.. I this last line I return the text to the message, but the email arrives without line breaks.

What can i do? thanks!

if you email format is in HTML, then you can use tag "<BR>" to create a line break

StringBuilder sb = new StringBuilder();
sb.Append("A lot of text 1");
sb.Append("<br>");
sb.Append("A lot of text 2);
return retorno.ToString() ;

else

you may try using \r\n, sb.Append("XXX\\r\\nXXXX");


have you tried for this one ?? it shoud work as it worked for me..

 StringBuilder retorno =new StringBuilder(); retorno.AppendLine("A lot of text 1"); retorno.AppendLine("<br />"); //....append a <br /> Tag... retorno.AppendLine("A lot of text 2"); Response.Write(retorno.ToString());

hope it helps./.

Saturday, March 24, 2012

striping text of special characters before displaying on webpage

I have this project I am working and I have two tasks

I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...

I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.Hi ebade2000,

String.Replace and Server.HtmlEncode should do the trick.

string s = "<display \r\n me>";
s = Server.HtmlEncode(s); // converts < etc
s = s.Replace("\r\n", "<br>"); // replaces string breaks withhtml
breaks
Response.Write(s);

On Tue, 12 Sep 2006 02:08:12 +0200, <ebade2000@.gmail.comwrote:

Quote:

Originally Posted by

I have this project I am working and I have two tasks
>
I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...
>
I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.
>


--
Happy Coding!
Morten Wennevik [C# MVP]
Thanks that helps a whole lot.

Bade

Morten Wennevik wrote:

Quote:

Originally Posted by

Hi ebade2000,
>
String.Replace and Server.HtmlEncode should do the trick.
>
string s = "<display \r\n me>";
s = Server.HtmlEncode(s); // converts < etc
s = s.Replace("\r\n", "<br>"); // replaces string breaks with html
breaks
Response.Write(s);
>
>
>
On Tue, 12 Sep 2006 02:08:12 +0200, <ebade2000@.gmail.comwrote:
>

Quote:

Originally Posted by

I have this project I am working and I have two tasks

I have a text form that takes in a users input and it is supposed to be
stored in a database and can be viewed from a webpage. I want to be
able to display the text with html special characters like "<", ">" (if
the user typed them in) without it being confused for html code and...

I want to be able to replace a newline character with a "/r/n" whenever
it is used in the text.


>
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]

Strong Naming a dll and registering in GAC

Hi,

I am working with Microsoft Configuration Application Blocks and whenever I
create a new app and have to use it, I have to reference it and it makes a
local copy in the bin directory.
so if i created 4 apps then there are local copies of these blocks...

I tried to use GACUtil to register these dlls but it gives me an error
saying that its not having a strong name, i tried sn tool but unsuccessful.
I have tried to strong name a dll but the way i did it was in an app where I
first created a strong name and then referenced it in the app before
compiling the dll and then used GAC to register it...
but this is some external dll...

I mean is my thought process right or I am totally off base...
Please advice,
Stephenstephen,
You cannot install an assembly in the GAC without a strong name so you need
to solve this problem first.
After that, you can put copies of strong named, GAC-ed assemblies in a
single folder and reference these from your various apps; you can turn off
the copy local feature, and the copy in the GAC will be automatically used.
Hope that helps,
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"stephen" wrote:

Quote:

Originally Posted by

>
Hi,
>
I am working with Microsoft Configuration Application Blocks and whenever I
create a new app and have to use it, I have to reference it and it makes a
local copy in the bin directory.
so if i created 4 apps then there are local copies of these blocks...
>
I tried to use GACUtil to register these dlls but it gives me an error
saying that its not having a strong name, i tried sn tool but unsuccessful.
I have tried to strong name a dll but the way i did it was in an app where I
first created a strong name and then referenced it in the app before
compiling the dll and then used GAC to register it...
but this is some external dll...
>
I mean is my thought process right or I am totally off base...
Please advice,
Stephen
>
>
>

Tuesday, March 13, 2012

Stuck on XML/XSLT with Asp.net 1.1 server controls.

Hello everyone,

I am working on a custom built portal system in Visual Studio 2003 and I amstuck on how to develop with XML/XSLT and using Asp.net server controls. Theportal consists of "applications" (each application is essentially a.aspx page) and those applications consists of "modules" (whichderives from UserControl). Now in order to maintain a consistent look for allmodules/applications and to minimize the amount of actual html hard coded, Iwant to use XSLT (which would contain the html) and CSS to help generate thatconsistent appearance. TheModule class containstitle andbodyfields, wherebodycan have any form of content (html/text/javascript),but sinceModulederives from UserControl, it can also contain .Net childcontrols, and I need those child controls to render correctly to take fulladvantage of Asp.Net. What would be the best approach to accomplish this inwhich the module would be transformed using a XSL file?


This also needs to apply to an application as well (or atleast the layout of the application, something that controls the placement ofthe modules). If I have a collection of modules, I need to put them in someform of structure or layout and transform that layout through an XSL file tohave a consistent look and only one place to look when we need to change thelook of a module or application. What would be the best approach for this orcould you point me in the right direction? If you need any furtherclarification, I would be more than willing to help. Thanks in advance!

Steve

Wow that was a lot...

Was there a specific bit of coding that you are stuck on or are you looking for a broadranged theory?


If you'd like I can tell you what I have right now, but I'mthinking it may be better to take a step back and look at it from a differentangle.Smile [:)] The first question is best approach to take a user control that contains child controls and other content, run it through an .xsl file, and have it display properly on the page. Thanks for your help!


User controls containing child controls is nothing special... in fact really just about every User Control ever made has child controls. User Controls, with User Controls would be nothing different really either...

Let me see if I have it right, before I comment...

You want your XML to contain the list of what's on each control, and the XSL to contain the "way" that the controls display? Is that correct?

And you are wondering if this is a good approach?

Stuck working on ecommerce carthelp plz?

I'm working on an ecommerce site with asp.net and I am currently focusing on the cart page. I have an incoming prodId and Qnty (quantity). These values are stored to an array (the reason for this is so that I can leave the cart page and come back and have all the cart items still available).

Then I set up a table for design elements. And in this table I add an inner-table. This inner table is where I assemble the Product Information. Since the array can have 1 to many items in it, this has proven tricky.

I made a loop to run as long as the array provides prodId's and in this loop I create a new Row on this inner-table. These rows have the product info for each product. There is the product name, price, quantity, removal box.

I add the controls to the table and it all works great with one entry in the array.
If there are multiple entries in the array, its no go. I am figuring this is because there is only one of each product info variable...and the loop creates rows with reference to these variables.

I am kinda stuck and wondering if anyone has any suggestions or other ways of going about this.

One idea that I have been wondering is the possibility of creating a variable whose name includes another variable?

In other words, create:

Dim prodLink0 as new hyperlink
(WHERE the 0 is the value of a variable, such as Y)

Dim prodLink1 as new hyperlink
(WHERE the 1 is the value of a variable, such as Y)

Dim prodLink2 as new hyperlink
(WHERE the 2 is the value of a variable, such as Y)

If I could do this...then I'de be able to make individual variables for each table row.

Any help would be so helpful.
Thanks a ton in advance.i recommend visiting these websites for better info on shopping carts:

1- http://www.quantumsoftware.com.au/OnlineLearning/Programming/DotNet/ASP/ShoppingCart.aspx

2-
http://www.codeproject.com/useritems/shopcart.asp

3-
http://www.sitepoint.com/article/1055

best of luck.