WowSlider无法完全从resx文件中读取图像标题

时间:2017-11-09 17:39:03

标签: asp.net-mvc slider resx wowslider

我正在为我的网站(ASP.net MVC)使用WowSlider(http://wowslider.com/)图像滑块。 当我在Img标题中使用简单文本时,它正确显示标题

<img src="~/Content/data1/images/01_____.jpg" 
              title="my image title" alt="my image title" id="wows1_0" />

但是当我想从我的资源文件(.resx)获取标题时,它只是读取第一个单词!

<img src="~/Content/data1/images/01_____.jpg" 
                  title=@Resources.HomeIndexRes.SliderImg01 alt=@Resources.HomeIndexRes.SliderImg01 id="wows1_0" />

我该怎么做才能让它读完整个标题?

我的完整索引代码如下:

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}

 <!-- Start Slider HEAD section --> 
 <link rel="stylesheet" type="text/css" href="~/Content/engine1/style.css" 
/>
 <script type="text/javascript" src="~/Content/engine1/jquery.js"></script>
<!-- End Slider HEAD section -->
<link href="~/Content/StyleSheet.css" rel="stylesheet" />


<!-- Start Slider BODY section -->
<div id="wowslider-container1">
<div class="ws_images">
    <ul>
        <li ><img src="~/Content/data1/images/01_____.jpg" 
                  title=@Resources.HomeIndexRes.SliderImg01 
alt=@Resources.HomeIndexRes.SliderImg01 id="wows1_0" /></li>
        <li><img src="~/Content/data1/images/02_________.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg02  
alt=@Resources.HomeIndexRes.SliderImg02  id="wows1_1" /></li>
        <li><img src="~/Content/data1/images/03______.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg03  
alt=@Resources.HomeIndexRes.SliderImg03 id="wows1_2" /></li>
        <li><img src="~/Content/data1/images/04______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg04  
 alt=@Resources.HomeIndexRes.SliderImg04 id="wows1_3" /></li>
        <li><img src="~/Content/data1/images/05____.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg05  
 alt=@Resources.HomeIndexRes.SliderImg05 id="wows1_4" /></li>
        <li><img src="~/Content/data1/images/06_______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg06  
alt=@Resources.HomeIndexRes.SliderImg06 id="wows1_5" /></li>
        <li><img src="~/Content/data1/images/07_____.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg07  
alt=@Resources.HomeIndexRes.SliderImg07 id="wows1_6" /></li>
        <li><img src="~/Content/data1/images/08_______.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg08  
 alt=@Resources.HomeIndexRes.SliderImg08 id="wows1_7" /></li>
        <li><img src="~/Content/data1/images/09_____.jpg" 
                 title=@Resources.HomeIndexRes.SliderImg09  
 alt=@Resources.HomeIndexRes.SliderImg09 id="wows1_8" /></li>
        <li><img src="~/Content/data1/images/10_____.jpg"  
                 title=@Resources.HomeIndexRes.SliderImg10  
 alt=@Resources.HomeIndexRes.SliderImg10 id="wows1_9" /></li>
    </ul>
    </div>
    <div class="ws_shadow"></div>
</div>
 <script type="text/javascript" src="~/Content/engine1/wowslider.js">
</script>
<script type="text/javascript" src="~/Content/engine1/script.js"></script>
<!-- End Slider BODY section -->

1 个答案:

答案 0 :(得分:1)

如果title属性值中包含空格,请在title="@Resources.HomeIndexRes.SliderImg01"属性值周围加上引号,否则该值将只是第一个单词。

namespace TESTDELETE { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Window_Initialized(object sender, EventArgs e) { ObservableCollection<Basemap> BMList; { BMList = new ObservableCollection<Basemap>(); BMList.Add(new Basemap("filename1", "desc1")); BMList.Add(new Basemap("filename2", "desc2")); BMList.Add(new Basemap("filename3", "desc3")); } datagrid1.DataContext = BMList; } } }