Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.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
SVG图像元素与Asp.NET_Asp.net_Svg - Fatal编程技术网

SVG图像元素与Asp.NET

SVG图像元素与Asp.NET,asp.net,svg,Asp.net,Svg,我正在使用SVG和ASP.NET。我有一些图像元素定义为SVG。基于一些操作,我想从asp.net代码更改SVG图像的路径 我是SVG新手。请告诉我如何在代码隐藏中访问SVG图像并执行所需的操作。任何其他关于SVG和asp.net的指导都将不胜感激 这是我的web形式svg标记: <svg width="600" height="500"> <rect x="10" y="10" height="250" width="500" style="fill:rgb(255,

我正在使用SVG和ASP.NET。我有一些图像元素定义为SVG。基于一些操作,我想从asp.net代码更改SVG图像的路径

我是SVG新手。请告诉我如何在代码隐藏中访问SVG图像并执行所需的操作。任何其他关于SVG和asp.net的指导都将不胜感激

这是我的web形式svg标记:

<svg width="600" height="500">
    <rect x="10" y="10" height="250" width="500" style="fill:rgb(255, 255, 255);stroke-width:3;stroke:rgb(0,0,0)" />
    <image x="20" y="50" width="300" height="80"
           xlink:href="http://dely.com/Svg/images/Layout/top-bar-logo.png" />
    <image x="15" y="125" width="300" height="80"
           xlink:href="http://dely.com/Svg/images/Layers/left-bar.png" />
</svg>

只要添加runat=“server”并使用属性修改代码后面的URL,我看不出有任何问题:

<svg width="600"  height="500">
        <rect x="10" y="10" height="250" width="500" style="fill:rgb(255, 255, 255);stroke-width:3;stroke:rgb(0,0,0)" />

        <image runat="server" id="imgTest" x="20" y="50" width="300" height="80" 
            xlink:href="http://dely.com/Svg/images/Layout/top-bar-logo.png" />
        <image x="15" y="125" width="300" height="80"
            xlink:href="http://dely.com/Svg/images/Layers/left-bar.png" />

    </svg>

似乎合法,但您是否尝试过在
svg
标记上运行
runat=“server”
?我很好奇。
imgTest.Attributes.Add("xlink:href", "http://icons.iconarchive.com/icons/aha-soft/free-3d-glossy-interface/64/accept-icon.png");