Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

C# problem sacuvati HTML code u bazu podataka kao string

[es] :: .NET :: .NET Desktop razvoj :: C# problem sacuvati HTML code u bazu podataka kao string

[ Pregleda: 2582 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

01011011

Član broj: 561
Poruke: 2341
204.167.145.*



+2 Profil

icon C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 15:00 - pre 222 meseci
Evo ovako da malko oduzim. Koristim TinuMCE editor kod mene u programu i onda znaci izvlacim podatke iz baze podataka koji su zajedno sa html kodom u editor i onda editujem. Nakon toga sve to sto je editovano npr.

Code:
Advanced Clinical Services LLC has a one-year consulting opportunity for an <strong>RN</strong>
 who has a strong desire to transition their career into <strong>Drug Safety</strong>. Our client,
 located in the Northeast, is conducting clinical trials to study the last generation of analgesics, <strong>anesthetics</strong>,
 and other therapeutics to manage pain.<br />
As part of the Drug Safety and Pharmacovigilance Team, the Drug Safety Analyst is responsible for collecting, conducting follow-up, 
and entering the adverse information from all
 sources into the safety database. The work 
is done in accordance with FDA and ICH Regulations and Guidelines.<br /><br />


pokusavam da sacuvam u bazu podataka. Znaci sve to stavljam u string i onda trpam u bazu podataka. Dogadja mi se sledece da kad se prikazuje ovaj tekst na html stranici da se prikazuje bas ovako sa kodovima html koji su prikazani na stranici i nista nije formatirano, to jest ovako isto.

Code:
Advanced Clinical Services LLC has a one-year consulting opportunity for an <strong>RN</strong>
 who has a strong desire to transition their career into <strong>Drug Safety</strong>. Our client,
 located in the Northeast, is conducting clinical trials to study the last generation of analgesics, <strong>anesthetics</strong>,
 and other therapeutics to manage pain.<br />
As part of the Drug Safety and Pharmacovigilance Team, the Drug Safety Analyst is responsible for collecting, conducting follow-up, 
and entering the adverse information from all
 sources into the safety database. The work 
is done in accordance with FDA and ICH Regulations and Guidelines.<br /><br />


E sad, kako sacuvati ovo da bi mi se pokazalo poslije iz baze podataka kao normalno.


Hvala,

[Ovu poruku je menjao 01011011 dana 11.01.2006. u 16:01 GMT+1]
 
Odgovor na temu

jablan

Član broj: 8286
Poruke: 4541



+711 Profil

icon Re: C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 15:21 - pre 222 meseci
HttpServerUtility.HtmlDecode
 
Odgovor na temu

01011011

Član broj: 561
Poruke: 2341
204.167.145.*



+2 Profil

icon Re: C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 15:48 - pre 222 meseci
I na koji nacin da koristim ovu klasu.

Hvala ponovo?
 
Odgovor na temu

jablan

Član broj: 8286
Poruke: 4541



+711 Profil

icon Re: C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 15:55 - pre 222 meseci
Pardon, u pitanju je statička metoda HttpUtility.HtmlDecode.

Baci pogled u help:
Citat:
The following example demonstrates the HtmlEncode and HtmlDecode methods of the HttpUtility class. The input string is taken from user and encoded using the HtmlEncode method.The encoded string thus obtained is then decoded using the HtmlDecode method.

[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of HtmlDecode. For other examples that might be available, see the individual overload topics.

[C#]
using System;
using System.Web;
using System.IO;

class MyNewClass
{
public static void Main()
{
String myString;
Console.WriteLine("Enter a string having '&' or '\"' in it: ");
myString=Console.ReadLine();
String myEncodedString;
// Encode the string.
myEncodedString = HttpUtility.HtmlEncode(myString);
Console.WriteLine("HTML Encoded string is "+myEncodedString);
StringWriter myWriter = new StringWriter();
// Decode the encoded string.
HttpUtility.HtmlDecode(myEncodedString, myWriter);
Console.Write("Decoded string of the above encoded string is "+
myWriter.ToString());
}
}



[Ovu poruku je menjao jablan dana 11.01.2006. u 16:57 GMT+1]
 
Odgovor na temu

01011011

Član broj: 561
Poruke: 2341
204.167.145.*



+2 Profil

icon Re: C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 16:48 - pre 222 meseci
Ne kontam kako da ovo iskoristim...

Evo ovako...

Prvo povlacim polje iz baze podataka
Code:
string longD = (ds.Tables[0].Rows[0]["Description"].ToString().Trim());

                if  ( longD != "" )
                {
                    description_text.Value = longD;
                    
                }


Nakon toga se rade promjene i sacuvavam promjene u string

Code:
string description = description_text.Value.ToString().Trim();



e sada kad uradim ovo da testiram description mi je ovako...

Code:
<em><strong><strong>Advanced Clinical Services LLC has a one-year consulting opportunity for an RN who <br /></strong>



znaci dobro je, ali kad ga saqacuvam u bazu podataka onda se sacuva kao ovo

Code:
&lt;strong&gt;Advanced Clinical Services LLC has a one-year consulting opportunity for an RN who&lt;/strong&gt;



E sada ja zelim da se ona sacuva u orginalnom obliku... kako ovo da izvedem?>



[Ovu poruku je menjao 01011011 dana 11.01.2006. u 17:49 GMT+1]
 
Odgovor na temu

01011011

Član broj: 561
Poruke: 2341
204.167.145.*



+2 Profil

icon Re: C# problem sacuvati HTML code u bazu podataka kao string11.01.2006. u 17:11 - pre 222 meseci
Skontao sam...Hvala mnogo na pomoci :)

Code:

string description1 = description_text.Value.ToString().Trim();

                    StringWriter myWriter = new StringWriter();
                    // Decode the encoded string.
                    HttpUtility.HtmlDecode(description1, myWriter);

                    string description = myWriter.ToString();


 
Odgovor na temu

[es] :: .NET :: .NET Desktop razvoj :: C# problem sacuvati HTML code u bazu podataka kao string

[ Pregleda: 2582 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.