Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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
Asp.net BorderStyle=NotSet和BorderStyle=None之间的差异_Asp.net - Fatal编程技术网

Asp.net BorderStyle=NotSet和BorderStyle=None之间的差异

Asp.net BorderStyle=NotSet和BorderStyle=None之间的差异,asp.net,Asp.net,每个web控件都有一个公共属性BorderStyle。它可以设置为许多值,其中两个是NotSeet和None。它们之间的基本区别是什么?BorderStyle属性实际上是作为控件标记中的style属性中的一个条目呈现出来的 None表示没有边框,控件将呈现一个特定的值来说明这一点NotSet让控件决定它应该是什么-最终控件不会呈现任何内容,这意味着要由页面上的任何css来设置边框样式 这段代码: void WebForm1_PreRender(object sender, EventArgs e

每个web控件都有一个公共属性BorderStyle。它可以设置为许多值,其中两个是NotSeet和None。它们之间的基本区别是什么?

BorderStyle属性实际上是作为控件标记中的
style
属性中的一个条目呈现出来的

None
表示没有边框,控件将呈现一个特定的值来说明这一点
NotSet
让控件决定它应该是什么-最终控件不会呈现任何内容,这意味着要由页面上的任何css来设置边框样式

这段代码:

void WebForm1_PreRender(object sender, EventArgs e)
{
    b = new Button();
    b.ID = "button1";
    b.Width = 100;
    b.Height = 50;
    b.BorderStyle = BorderStyle.NotSet;

    c = new Button();
    c.ID = "button2";
    c.Width = 100;
    c.Height = 50;
    c.BorderStyle = BorderStyle.None;

    div1.Controls.Add(b);
    div1.Controls.Add(c);
}
呈现为以下HTML格式:

<div id="div1">
    <input type="submit" name="button1" value="" id="button1" style="height:50px;width:100px;" />
    <input type="submit" name="button2" value="" id="button2" style="border-style:None;height:50px;width:100px;" />
</div>


请注意Button2是如何显式关闭其BorderStyle的。

BorderStyle属性实际上是作为控件标记中的
style
属性中的一个条目呈现的

None
表示没有边框,控件将呈现一个特定的值来说明这一点
NotSet
让控件决定它应该是什么-最终控件不会呈现任何内容,这意味着要由页面上的任何css来设置边框样式

这段代码:

void WebForm1_PreRender(object sender, EventArgs e)
{
    b = new Button();
    b.ID = "button1";
    b.Width = 100;
    b.Height = 50;
    b.BorderStyle = BorderStyle.NotSet;

    c = new Button();
    c.ID = "button2";
    c.Width = 100;
    c.Height = 50;
    c.BorderStyle = BorderStyle.None;

    div1.Controls.Add(b);
    div1.Controls.Add(c);
}
呈现为以下HTML格式:

<div id="div1">
    <input type="submit" name="button1" value="" id="button1" style="height:50px;width:100px;" />
    <input type="submit" name="button2" value="" id="button2" style="border-style:None;height:50px;width:100px;" />
</div>

请注意Button2是如何显式关闭其边框样式的