小编Lin*_*ell的帖子

<input type ="?"的CSS选择器

有没有办法用CSS根据类型定位所有输入?我有一个禁用的类我在各种禁用的表单元素上使用,我正在设置文本框的背景颜色,但我不希望我的复选框获得该颜色.

我知道我可以用单独的类来完成这个,但是如果可能的话我宁愿使用CSS.我敢肯定,我可以在javascript中设置它,但再次寻找CSS.

我的目标是IE7 +.所以我认为我不能使用CSS3.

编辑

使用CSS3,我可以做类似的事情吗?

INPUT[type='text']:disabled 那会更好地完全摆脱我的班级......

编辑

好的,谢谢你的帮助!所以这里是一个选择器,修改所有已禁用的文本框和区域,而不需要设置任何类,当我开始这个问题时,我从未想过这是可能的......

INPUT[disabled][type='text'], TEXTAREA[disabled]
{   
    background-color: Silver;
}
Run Code Online (Sandbox Code Playgroud)

这适用于IE7

css internet-explorer css-selectors

105
推荐指数
1
解决办法
13万
查看次数

浏览器检测

我需要将IE和FF浏览器与其他浏览器分开

这是一个伪代码:

If (CurrentBrowser == IE(6+) or FF(2+) )
{
...
}
else 
{
...
}
Run Code Online (Sandbox Code Playgroud)

protected void Page_Load()事件中(这样认为)

if ((Request.Browser.Type == "IE") || (Request.Browser.Type == "FF"))
{
    WebMsgBox.Show("1111");
}
Run Code Online (Sandbox Code Playgroud)

没有效果: - /什么是IE和FF类型?

c# asp.net browser-detection

47
推荐指数
3
解决办法
10万
查看次数

使用HttpContext OutputStream写入ZipArchive

我一直试图让.NET 4.5(System.IO.Compression.ZipArchive)中包含的"新"ZipArchive 在ASP.NET站点中工作.但似乎它不喜欢写入流HttpContext.Response.OutputStream.

我的下面的代码示例将抛出

System.NotSupportedException:不支持指定的方法

只要在流上尝试写入.

CanWrite流上的属性返回true.

如果我将OutputStream与文件流交换,指向本地目录,它就可以工作.是什么赋予了?

ZipArchive archive = new ZipArchive(HttpContext.Response.OutputStream, ZipArchiveMode.Create, false);

ZipArchiveEntry entry = archive.CreateEntry("filename");

using (StreamWriter writer = new StreamWriter(entry.Open()))
{
    writer.WriteLine("Information about this package.");
    writer.WriteLine("========================");
}
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

[NotSupportedException: Specified method is not supported.]
System.Web.HttpResponseStream.get_Position() +29
System.IO.Compression.ZipArchiveEntry.WriteLocalFileHeader(Boolean isEmptyFile) +389
System.IO.Compression.DirectToArchiveWriterStream.Write(Byte[] buffer, Int32 offset, Int32 count) +94
System.IO.Compression.WrappedStream.Write(Byte[] buffer, Int32 offset, Int32 count) +41
Run Code Online (Sandbox Code Playgroud)

c# outputstream httpcontext .net-4.5 asp.net-4.5

36
推荐指数
3
解决办法
1万
查看次数

如何制作进度条

如何在html/css/javascript中创建进度条.我真的不想使用Flash.可以在这里找到的东西:http://dustincurtis.com/about.html

我真正想要的只是一个'进度条',它改变了我在PHP中给出的值.你的过程会是什么?这有什么好的教程吗?

html javascript css progress-bar

35
推荐指数
6
解决办法
15万
查看次数

用户'IIS APPPOOL\myAppPool登录失败

我有以下错误消息:

无法打开登录请求的数据库"SmallBakery".登录失败.用户'IIS APPPOOL\MyAppPool'登录失败

怎么能纠正这个?我正在使用Windows 7企业版和Sql server 2012.

sql-server asp.net iis-7

20
推荐指数
1
解决办法
4万
查看次数

飞溅屏幕等待螺纹完成

我仍然有启动画面的问题.我不想使用该属性SC.TopMost=true.

现在我的应用场景如下:

在progeram.cs中:

[STAThread]
static void Main()
{
    new SplashScreen(_tempAL);// where _tempAL is an arrayList
    Application.Run(new Form1(_tempAL));
}
Run Code Online (Sandbox Code Playgroud)

在SplashScreen类中:

public SplashScreen(ArrayList _Data)
{
    DisplaySplash()
} 
private void DisplaySplash()
{
    this.Show();
    this.TopMost = true;
    this.CenterToScreen();
    this.SetTopLevel(true);

    _allServerNarrators = new string[10];
    for (int i = 0; i < _allServerNarrators.Length; i++)
        _allServerNarrators[i] = null;

    GetFromServer();

    this.Hide();
    _serverData = new ArrayList();
    _thisData.Add(_allServerNarrators);
    _thisData.Add(_serverNarrators);

}
private void GetFromServer()
{
    _serverNarrators = new ArrayList();
    string _file = "Suras.serverNar";

    if (!Directory.Exists("c:\\ASGAQuraan"))
        Directory.CreateDirectory("c:\\ASGAQuraan");

    while (counter < …
Run Code Online (Sandbox Code Playgroud)

c# splash-screen winforms

19
推荐指数
2
解决办法
2万
查看次数

更改<select> HTML表单上的边框颜色

是否可以更改<select/>HTML表单中元素的边框颜色?

border-color样式适用于Firefox,但不适用于IE.

我在谷歌上找不到真正的答案.

html css html-select

16
推荐指数
2
解决办法
13万
查看次数

通用协方差和逆变

考虑代码片段.

IList<String> obj=new List<string>();
IEnumerable<Object> obj1 = obj;
Run Code Online (Sandbox Code Playgroud)

但如果我写ICollection<Object> obj2 = obj;它会抛出编译时错误.

无法隐式将类型' System.Collections.Generic.IList<string>' 转换为' System.Collections.Generic.ICollection<object>'.

为什么,因为这种行为List<T>同时实现了IEnumerable<T>ICollection<T>,也IList<T>被定义为

public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
{
    T this[int index] { get; set; }
    int IndexOf(T item);
    void Insert(int index, T item);
    void RemoveAt(int index);
}
Run Code Online (Sandbox Code Playgroud)

c# generics covariance contravariance

16
推荐指数
1
解决办法
1266
查看次数

如何在IE 6中将浮动页脚粘贴到视口底部?

我知道这对于位置很容易:固定,但不幸的是我坚持支持IE 6.我怎么能这样做?我宁愿使用CSS来干净,但如果我必须使用Javascript,那不是世界末日.在我目前的实现中,我有一个"浮动页脚"浮动在主要内容区域上方,并使用Javascript定位.我现在的实现即使使用Javascript也不是特别优雅,所以我的问题是:

  1. 有没有办法在没有Javascript的情况下执行此操作?
  2. 如果我必须使用Javascript,这个浮动页脚问题是否有任何"好"的解决方案?"很好"我指的是可以跨浏览器工作的东西,不会超载浏览器的资源(因为它必须经常重新计算),并且优雅/易于使用(即写出类似的东西会很好new FloatingFooter("floatingDiv")).

我猜想没有超级简单的解决方案可以满足上述所有要求,但我可以构建的东西会很棒.

最后,只是一个更普遍的问题.我知道这个问题很难解决,那么其他UI替代方案是什么,而不是在每个页面的底部都有页脚内容?在我的特定网站上,我用它来显示步骤之间的转换.还有其他方法吗?

javascript css sticky-footer internet-explorer-6

12
推荐指数
1
解决办法
3万
查看次数

使用Lambda的属性构造函数

可能做到这一点:

public static void SomeMethod<TFunc>(Expression<TFunc> expr)
{
    //LambdaExpression happily excepts any Expession<TFunc>
    LambdaExpression lamb = expr;
}
Run Code Online (Sandbox Code Playgroud)

并在其他地方调用它传递参数的lambda:

SomeMethod<Func<IQueryable<Person>,Person>>( p=>p.FirstOrDefault());
Run Code Online (Sandbox Code Playgroud)

我想改为将表达式作为参数传递给属性构造函数. 可以这样做吗?

class ExpandableQueryAttribute: Attribute {
    private LambdaExpression someLambda;
    //ctor
    public ExpandableQueryMethodAttribute(LambdaExpression expression) 
    {
        someLambda = expression
    } 
}

//usage:
static LambdaExpression exp = 
      (Expression<Func<IQueryable<Person>, Person>>)
        (p => p.FirstOrDefault());

[ExpandableQueryAttribute(exp)]   //error here
// "An attribute argument must be a constant expression, typeof expression
// or array creation expression of an attribute parameter type"
Run Code Online (Sandbox Code Playgroud)

我的目标是在属性的构造函数中指定方法或lambda(即使我必须声明一个完整的命名方法并以某种方式传递方法的名称,这样就可以了).

  1. 参数类型可以更改,但重要的是属性构造函数可以获取该参数,并以某种方式将其分配给LambdaExpression类型的字段

  2. 我希望lambda …

c# lambda custom-attributes

10
推荐指数
1
解决办法
6788
查看次数