I have an issue that I just cant seem to get correct, and I really do not understand why.
I have a page that loads some HTML from a SQL database and I want it displayed in the RadEditor control. The idea is to load the record they have marked as default on the page load, and then have a ComboBox so they can switch from record to record. The html that comes from the database doesn't have any header tags like "<html>" or "<header>", but it is well formed html with style and formatting tags like tables, paragraphs, etc...
On Page Load I want to get the record (which loads successfully) and display it in the control. However on page load when I do the following, the editor is empty and it is not in preview mode - the toolbar buttons are still luminated.
But then when I do this - it works fine:
They are identical but why doesn't the page load display it properly?
I have a page that loads some HTML from a SQL database and I want it displayed in the RadEditor control. The idea is to load the record they have marked as default on the page load, and then have a ComboBox so they can switch from record to record. The html that comes from the database doesn't have any header tags like "<html>" or "<header>", but it is well formed html with style and formatting tags like tables, paragraphs, etc...
|
|||||||||||||||
<tr> | |||||||||||||||
<td align="right"> | |||||||||||||||
Message Subject:</td> | |||||||||||||||
<td> | |||||||||||||||
</td> | |||||||||||||||
<td align="left"> | |||||||||||||||
<telerik:RadTextBox ID="txt_Sub" Runat="server" Skin="Sunset" Width="400px" Text=""> | |||||||||||||||
</telerik:RadTextBox> | |||||||||||||||
</td> | |||||||||||||||
</tr> | |||||||||||||||
<tr> | |||||||||||||||
<td colspan="3"><center> | |||||||||||||||
<telerik:RadEditor ID="editor_SEND" runat="server" BorderStyle="None" | |||||||||||||||
EditModes="Preview" Height="400px" Skin="Sunset" | |||||||||||||||
ToolsFile="UserControls/EditorToolbar.xml" Width="700px"> | |||||||||||||||
<Content> | |||||||||||||||
</Content> | |||||||||||||||
</telerik:RadEditor></center> | |||||||||||||||
<br /> | |||||||||||||||
<br /> | |||||||||||||||
<asp:Button ID="btn_SendMsg" runat="server" CssClass="RadDefaultButton" | |||||||||||||||
Text="Send Message" /> | |||||||||||||||
</td> | |||||||||||||||
</tr> |
On Page Load I want to get the record (which loads successfully) and display it in the control. However on page load when I do the following, the editor is empty and it is not in preview mode - the toolbar buttons are still luminated.
If Not IsPostBack Then |
Try |
Using reader As SqlDataReader = Msg_Info.GetDealerTemplateByID(CInt(Request.QueryString("Record"))) |
If reader.HasRows Then |
reader.Read() |
txt_Sub.Text = reader.GetSqlString(0).ToString() |
editor_SEND.Content = reader.GetSqlString(1).ToString() |
End If |
reader.Close() |
End Using |
Catch ex As Exception |
'error |
End Try |
End If |
But then when I do this - it works fine:
Protected Sub list_templates_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) |
Dim msgID As Integer = list_templates.SelectedValue |
Try |
Using reader As SqlDataReader = Msg_Info.GetDealerTemplateByID(msgID) |
If reader.HasRows Then |
reader.Read() |
txt_Sub.Text = reader.GetSqlString(0).ToString() |
editor_SEND.Content = reader.GetSqlString(1).ToString() |
End If |
reader.Close() |
End Using |
Catch ex As Exception |
End Try |
End Sub |
They are identical but why doesn't the page load display it properly?