Pregunta

He intentado eliminar la siguiente etiqueta generada por el kit de herramientas de control AJAX. El escenario es que nuestro equipo de GUI utilizó el kit de herramientas de control AJAX para hacer la GUI, pero necesito moverlos a la etiqueta de vista ASP .NET normal usando MultiView.

Quiero eliminar todos los __designer: atributos

Aquí está el código

<asp:TextBox ID="a" runat="server" __designer:wfdid="w540" />
<asp:DropdownList ID="a" runat="server" __designer:wfdid="w541" />
.....
<asp:DropdownList ID="a" runat="server" __designer:wfdid="w786" />

Traté de usar la expresión regular find replace en Visual Studio usando:

Buscar:

:__designer\:wfdid="w{([0-9]+)}"

Reemplazar con espacio vacío

¿Puede ayudar un experto en expresiones regulares?

¿Fue útil?

Solución

/*
 * Created by SharpDevelop.
 * User: box
 * Date: 2009-9-13
 * Time: 8:13
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Text.RegularExpressions;

namespace t1
{
    class Sample
    {
        public static void Main()
        {
            // Create a regular expression that matches a series of one
            // or more white spaces.
            string pattern = @"__designer:wfdid=""w\d+""";
            Regex rgx = new Regex(pattern);

            // Declare a string consisting of text and white spaces.
            string aspCode = @"<asp:TextBox ID=""a"" runat=""server"" __designer:wfdid=""w540"" />";

            // Replace runs of white space in the input string with a
            // comma and a blank.
            string outputStr = rgx.Replace(aspCode, ", ");

            // Display the resulting string.
            Console.WriteLine("Pattern:       \"{0}\"", pattern);
            Console.WriteLine("Input string:  \"{0}\"", aspCode);
            Console.WriteLine("Output string: \"{0}\"", outputStr);
        }
    }
}

Otros consejos

Si desea deshacerse de __designer: mapid = " 22 "

usa esta expresión regular

< __ designer: mapid =: q

desde 'Buscar opción' use la búsqueda con comodines:

  

__designer: wfdid = " * "

buscarlos todos y reemplazarlos con vacíos.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top