是否可以使用C#在.NET中将两个或多个列表转换为一个列表?
例如,
public static List<Product> GetAllProducts(int categoryId){ .... }
.
.
.
var productCollection1 = GetAllProducts(CategoryId1);
var productCollection2 = GetAllProducts(CategoryId2);
var productCollection3 = GetAllProducts(CategoryId3);
Run Code Online (Sandbox Code Playgroud) 我正在寻找一个正则表达式来隔离img的src值.(我知道这不是最好的方法,但这是我在这种情况下必须做的)
我有一个字符串,其中包含简单的HTML代码,一些文本和图像.我需要从该字符串中获取src属性的值.到目前为止,我只设法将整个标签隔离开来.
string matchString = Regex.Match(original_text, @"(<img([^>]+)>)").Value;
Run Code Online (Sandbox Code Playgroud) 这是我网站的主菜单:

正如您所注意到的,主菜单项目中的文本没有包装.我尝试了许多解决方案,但似乎没有任何影响这些项目.这是css代码:
#pt_custommenu .parentMenu a{
width: 100px; height: 59px;
line-height: normal;
padding-top: 0; padding-bottom:0;
float:left;
display: inline-block;
position: relative;
text-transform: none;
word-wrap: normal;
white-space: normal !important;
}
Run Code Online (Sandbox Code Playgroud)
我想将文本分成两行,就像通常那样,因为<a>元素具有标准的宽度和高度.
有什么建议?
我在我的网站上使用以下代码来创建缩略图:
string furl = "~/images/thumbs/" + matchString;
lBlogThumb.ImageUrl = GetThumbnailView(furl, 200, 200);
private string GetThumbnailView(string originalImagePath, int height, int width)
{
//Consider Image is stored at path like "ProductImage\\Product1.jpg"
//Now we have created one another folder ProductThumbnail to store thumbnail image of product.
//So let name of image be same, just change the FolderName while storing image.
string thumbnailImagePath = originalImagePath.Replace("thumbs", "thumbs2");
//If thumbnail Image is not available, generate it.
if (!System.IO.File.Exists(Server.MapPath(thumbnailImagePath)))
{
System.Drawing.Image imThumbnailImage;
System.Drawing.Image OriginalImage = System.Drawing.Image.FromFile(Server.MapPath(originalImagePath));
imThumbnailImage …Run Code Online (Sandbox Code Playgroud) 我用cufon字体创建了一个菜单.
我决定在菜单项上应用以下样式:
问题是,将(红色)活动菜单项悬停,结果将其变回灰色(并使其看起来像任何其他"普通"菜单项).我不明白为什么,你能帮我解决一下吗?
这是当前的cufon配置:
Cufon.replace('ul#mainmenu li > a', {
color: '#868686',
fontFamily: 'pfbeau',
fontSize: '15px',
textShadow: '0 2px 0.1em #fff',
hover: {
color: '#3e3e3e'
}
});
Cufon.replace('ul#mainmenu li.active > a', {
color: '#af1217',
fontFamily: 'pfbeau',
fontSize: '15px',
textShadow: '0 2px 0.1em #fff',
hover: false
});
Run Code Online (Sandbox Code Playgroud) 我使用Cycle2 Carousel创建了一个旋转木马你可以在这里看到它:http: //jsfiddle.net/ktsixit/3BjHQ/
请注意两个问题:1)无论我做什么,h4内的文本都不会换行.2)每次轮播移动时,滑动的项目从一开始就不可见,但在幻灯片动画完成后可见.
你能帮我解决这两个问题吗?
这是HTML代码:
<div class="carousel_container">
<div class="slideshow" data-cycle-fx="carousel" data-cycle-slides="> div" data-cycle-timeout="0" data-cycle-carousel-visible="2" data-cycle-next="#next" data-cycle-prev="#prev">
<div class="carousel_item">
<img src="http://malsup.github.io/images/beach1.jpg">
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3>
</div>
<div class="carousel_item">
<img src="http://malsup.github.io/images/beach2.jpg">
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3>
</div>
<div class="carousel_item">
<img src="http://malsup.github.io/images/beach3.jpg">
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3>
</div>
<div class="carousel_item">
<img src="http://malsup.github.io/images/beach4.jpg">
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3>
</div>
<div class="carousel_item">
<img src="http://malsup.github.io/images/beach5.jpg">
<h3>Lorem …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用google maps api v3 javascript创建一个包含多个标记的地图.我读了很多教程,我真的很困惑infowindows/infobubbles.是同一件事还是他们不同,怎么样?在我看来,它们是两个不同的东西,因为在每种情况下创建了不同的对象.
var infowindow = new google.maps.InfoWindow();
var infobubble = new google.maps.InfoBubble();
Run Code Online (Sandbox Code Playgroud)
有人知道更多相关信息吗?
我正在尝试为preg_replace找到一个表达式,它删除图像的所有内联css样式.例如,我有这样的文字:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <img style="float:left; margin:0 0 10px 10px;" src="image.jpg" /> Proin vestibulum libero id nisl dignissim eu sodales.
Run Code Online (Sandbox Code Playgroud)
我需要让它看起来像:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <img src="image.jpg" /> Proin vestibulum libero id nisl dignissim eu sodales.
Run Code Online (Sandbox Code Playgroud)
我已经尝试过几十种表达方式
preg_replace("%<img(.*?)style(.*?)=(.*?)(\'|\")(.+?)(\'|\")(.*?)>%i", "<img\$1\$7>", $article->text)
Run Code Online (Sandbox Code Playgroud)
但没有任何效果.有什么建议?
我想onclick在列表的每个链接的属性中添加JavaScript代码.该代码用于Google Analytics分析事件跟踪.
这是清单:
<ol>
<li>
<a href="">Alberto Guardiani</a>
</li>
<li>
<a href="">Antica Bottega</a>
</li>
<li>
<a href="">Ash</a>
</li>
<li>
<a href="">Ballin</a>
</li>
</ol>
Run Code Online (Sandbox Code Playgroud)
这是jquery附加onclick代码后应该是这样的:
<ol>
<li>
<a href="" onclick="_gaq.push(['_setCustomVar', 2, 'Designer', 'text1', 3]);">text1</a>
</li>
<li>
<a href="" onclick="_gaq.push(['_setCustomVar', 2, 'Designer', 'text2', 3]);">text2</a>
</li>
<li>
<a href="" onclick="_gaq.push(['_setCustomVar', 2, 'Designer', 'text3', 3]);">text3</a>
</li>
<li>
<a href="" onclick="_gaq.push(['_setCustomVar', 2, 'Designer', 'text4', 3]);">text4</a>
</li>
</ol>
Run Code Online (Sandbox Code Playgroud)
我不知道这是否可能与jQuery append或我应该怎么做这个问题.你能建议某种解决方案吗?
c# ×3
css ×3
image ×2
jquery ×2
regex ×2
.net ×1
coding-style ×1
cufon ×1
hover ×1
infobubble ×1
infowindow ×1
javascript ×1
jquery-cycle ×1
list ×1
menu ×1
onclick ×1
php ×1
preg-replace ×1
resize ×1
src ×1
thumbnails ×1