HTML Editor in ext.net Asp.net C#


Sometimes we come across the Scenario to save the Data in Html Format that means the tags are rendered with text(For example if we apply Color, Bold or paragraph any other aspects) in the Database and when we want to update the Information we need to retrieve the data as it is and set to the Html Editor as it is.So how do you work with Html Editor using ext.net in asp.net.

Why we need to go Ext.Net HTML Template :

When you are working of any Diagnostic type of Projects you come across the Scenario to enter the Patient Information in an Html format and save it into Database. At present in ASP.Net there is no .Net Control of having Html Template . But you can find Ajax.Editor Editor Template you might face some issues in Using that especially rendering and setting the values to the Editor Template.

so you need to Html Template Editor which is other than Ajax .Net Control which can serve our Purpose and you can find it in ext.net Html Editor.

Html Editor Template Code in ext.net Looks like



ext:HtmlEditor
ID="HtmlEditor1"
runat="server"
Width="600"
EnableAlignments="false"
EnableFontSize="false"
CreateLinkText="My CreateLinkText"
ButtonTips
BackColor Text="My BackColor Tip"
Bold Text="My Bold Tip"
ButtonTips
ext:HtmlEditor



if you want insert with tags in the Database...

That can be done with the Following .....




string hTMLFormat= this.HTMLEditor1.innerHtml;



With the above code you can insert the data in the database with Html tags rendered with text. If we apply bold or if we apply Color or if we apply Paragraph or any thing we can apply in that.


if you do n't want Html tags rendered in that text than do the below code...



string Name = this.HTMLEditor1.Text;





this.HTMLEditor1.SetValue( from the database... )

or

this.HTMLEditor1..value = database value with html rendered tags;


Note : some versions of ext.net may raise an exception when we want update the Information you want to set the Values to the Html Editor text box . you may get an Exception along with the text . put try and Catch exception in the Catch block you can keep a check point and there if the ex.Message.Contains("") and Curtail the Exception and set the value in Editor Html Template.

Editor Html


Attachments

Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 74 articles authored by srirama

Comments



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: