Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Javascript打开<&&燃气轮机;在GridView编辑框中_C#_Asp.net_Gridview_Updatepanel_Html Encode - Fatal编程技术网

C# Javascript打开<&&燃气轮机;在GridView编辑框中

C# Javascript打开<&&燃气轮机;在GridView编辑框中,c#,asp.net,gridview,updatepanel,html-encode,C#,Asp.net,Gridview,Updatepanel,Html Encode,我在UpdatePanel中有一个Asp.NETGridView。除了其中一列包含HTML特殊字符(如)外,所有这些都可以正常工作。GridView绑定到一个列表,实体类有一个属性Regex,它是一个System.Text.RegularExpressions.Regex 起初我有这样一个想法: <asp:TemplateField HeaderText="RegEx"> <ItemTemplate> <asp:Label ID="RegEx

我在UpdatePanel中有一个Asp.NETGridView。除了其中一列包含HTML特殊字符(如
)外,所有这些都可以正常工作。GridView绑定到一个
列表
,实体类有一个属性
Regex
,它是一个
System.Text.RegularExpressions.Regex

起初我有这样一个想法:

<asp:TemplateField HeaderText="RegEx">
    <ItemTemplate>
        <asp:Label ID="RegExLabel" runat="server" Text='<%#Eval("Regex") %>' 
                   ToolTip='<%#Eval("Regex") %>' Width="102px" CssClass="Wrap" />
    </ItemTemplate>
    <EditItemTemplate>
        <asp:TextBox ID="RegExTextBox" runat="server" Text='<%#Eval("Regex") %>' 
                     Width="98px" />
    </EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="RegEx">
     <ItemTemplate>
          <asp:Label ID="RegExLabel" runat="server" 
                     Text='<%#System.Web.HttpUtility.HtmlEncode(Eval("Regex").ToString()) %>' 
                     ToolTip='<%#System.Web.HttpUtility.HtmlEncode(Eval("Regex").ToString()) %>'
                     Width="102px" CssClass="Wrap" />
     </ItemTemplate>
     <EditItemTemplate>
          <asp:TextBox ID="RegExTextBox" runat="server" 
                       Text='<%#System.Web.HttpUtility.HtmlEncode(Eval("Regex").ToString()) %>' 
                       Width="98px" />
     </EditItemTemplate>
</asp:TemplateField>
这稍微好一点,因为工具提示和非编辑版本显示正确,但当我开始编辑时,我看到:
(?capture\d+
,HTML实体显示为原始。是否有人知道如何对值进行编码(以停止脚本错误),同时在编辑时仍正确显示它们,而HTML实体不处于原始状态?


<asp:TemplateField HeaderText="RegEx">
    <ItemTemplate>
        <asp:Literal Mode="Encode" ID="RegExLabel" runat="server" Text='<%#Eval("Regex") %>' 
                   ToolTip='<%#Eval("Regex") %>' Width="102px" CssClass="Wrap" />
    </ItemTemplate>
    <EditItemTemplate>
        <asp:TextBox ID="RegExTextBox" runat="server" Text='<%#Eval("Regex") %>' 
                     Width="98px" />
    </EditItemTemplate>
</asp:TemplateField>
并在页面指令中添加此
ValidateRequest=“false”


并在页面指令中添加此
ValidateRequest=“false”