4

I'm currently trying to integrate a rich text editor into my web part.

I've found that I can integrate an InputFormTextBox in my aspx page :

<SharePoint:InputFormTextBox ID="DescriptionTextField" RichText="true" RichTextMode="FullHtml" runat="server" TextMode="MultiLine" Rows="10"></SharePoint:InputFormTextBox>

But this doesn't work :(

The text field is rendered as a simple text field without any buttons to set rich text styles and if i type text into the field, it directly disappears.

I've two JS errors when loading this page :

Message: Invalid source HTML for this operation.
Line: 33
Char: 3
Code: 0
URI: http://localhost/_layouts/1033/form.debug.js?rev=54QM7qflcW2Cscw0gwqGhg%3D%3D

Message: 'selection' is null or not an object
Line: 375
Char: 2
Code: 0
URI: http://localhost/_layouts/1033/form.debug.js?rev=54QM7qflcW2Cscw0gwqGhg%3D%3D

But I don't know how to solve the problem.

Does somebody have an idea ?

Thanks

2 Answers 2

1

The solution in this blog post shows you how to use the Rich Text control from SharePoint 2007 in a SharePoint 2010 custom web part: http://blog.mastykarz.nl/rich-text-editor-control-sharepoint-2010/

You could also try using the Publishing Rich Text HTML control: http://msdn.microsoft.com/en-us/library/ms561507.aspx

0

Try this :

< asp:TextBox ID="empFirstNameTextBox" runat="server" Width="200px"/ >


< asp:Button ID="submitBtn" runat="server" onclick="submitItems" 
    Text="Submit Security Request" />



       protected void submitItems(object sender, EventArgs e)
        {
                 using (SPSite site = new SPSite(ConnectionString.getCurrentSite()))
                 {
                     using (SPWeb web = site.OpenWeb())
                     {
                         web.AllowUnsafeUpdates = true;
                         SPList list = web.Lists["EmployeeData"];
                         SPListItem item = list.Items.Add();
                         item["Title"] = empFirstNameTextBox.Text;
                        item.Update();

                     }
                }
           }


        public string getCurrentSite()
        {
            string currentSite = SPContext.Current.Web.Url;
            return currentSite;
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.