是否可以使用富文本框(可以使用粗体等)来编辑Web部件属性中的字符串?
更新/解决方案
The 1st class is the "Custom property" that should appear in the toolbar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace MyCustomProperty
{
public class RichTextToolbarProperty : Microsoft.SharePoint.WebPartPages.ToolPart
{
InputFormTextBox textBox;
Panel toolPartPanel;
protected override void CreateChildControls()
{
toolPartPanel = new Panel();
toolPartPanel.GroupingText = "Default text here";
textBox = new InputFormTextBox();
textBox.TextMode = TextBoxMode.MultiLine;
textBox.Rows = 10;
textBox.RichText = true;
textBox.RichTextMode = SPRichTextMode.FullHtml;
BasePublicationWebPart wp = (BasePublicationWebPart)this.ParentToolPane.SelectedWebPart; …Run Code Online (Sandbox Code Playgroud) 这是一个非常简单的问题.
我有这样的HTML代码:
<div>
<img src="image1.jpg" alt="test1" />
</div>
<div>
<img src="image2.jpg" alt="test2" />
</div>
<div>
<img src="image3.jpg" alt="test3" />
</div>
Run Code Online (Sandbox Code Playgroud)
等等...
数据来自DB(图像名称,替代文本).
在JAVA中,我会做类似的事情:
将信息保存在后端的数组中.
对于演示文稿,我将使用JSTL循环它:
<c:foeach items="${data}" var="${item}>
<div>
<img src="${item.image}" alt="${item.alt}" />
</div>
</c:foreach>
Run Code Online (Sandbox Code Playgroud)
什么是ASP.net中的最佳实践我只是不想在"代码隐藏"中创建带有HTML代码的字符串,这是丑陋的IMO.