This is a migrated thread and some comments may be shown as answers.

HTML rendering issue

1 Answer 20 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Saeid Kdaimati
Top achievements
Rank 2
Saeid Kdaimati asked on 27 Oct 2014, 08:14 AM
Hi,

I'm using code snippet as follows:
Title = string.Format("<a class=\"LeadStory\" href=\"/Report/{0}/{1}\"><h1>{2}</h1></a>",
                            ds.Tables[0].Rows[0]["report_id"].ToString(),
                            aaHelper.Text.StripText.UrlTitle(ds.Tables[0].Rows[0]["title"].ToString()),
                            ds.Tables[0].Rows[0]["title"].ToString());
 
                    ReadMore = string.Format("<a class=\"LeadFullReport\" href=\"Report/{0}/{1}\">full report</a>",
                        ds.Tables[0].Rows[0]["report_id"].ToString(),
                        aaHelper.Text.StripText.UrlTitle(ds.Tables[0].Rows[0]["title"].ToString()));
RadEditor1.Snippets.Add("Lead Title", Title);
                    RadEditor1.Snippets.Add("Full Report", ReadMore);
When I insert both code snippets, the "Full Report" works correctly, but the problem is with the "Title", where the editor generate it like: <a....></a><h1>....</h1>
Even when I manually change the code in HTML view then switch back to design view, the editor change the code again.

I'm using version 2014.2.724.45

Any idea?

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 29 Oct 2014, 12:21 PM
Hi Saeid,

Note that the RadEditor control is designed to be an XHTML editor and all generated HTML should be valid as per to the W3C specifications.

Nesting block elements (e.g., H[1-6], P, UL etc.) in an inline element (e.g., SPAN, A, FONT etc.) is an invalid scenario and it causes W#C validation to fail. This is why the built-in filters of the RadEditor correct this invalid element nesting and move the block element outside the inline one. You can also examine a related discussion on the topic in this Stackoverflow forum thread.

I suggest redesigning the HTML created in the snippets to pass the W3C validation. You can also use the built-in W3C dialog titled XHTML Validator for you convenience.

Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
Saeid Kdaimati
Top achievements
Rank 2
Answers by
Ianko
Telerik team
Share this question
or