堅持學asp.net——(三)

來源:互聯網
上載者:User
asp.net 表單的幾種:



asp.net的響應:



form在asp.net中的工作方式:

伺服器控制項實際上是在伺服器上動態產生的,然後發送出去。

標記是:<form runat=“server“>

所有的asp.net的表單都是使用post方式進行傳遞的。

asp.net的表單是有狀態的,前翻如果有表單,而且你曾經輸入過內容時候,其內容是保留的;而html表單是無狀態的,不能做到這一點。(實際過程中,html表單也能在短暫的時間具有這一功能,只是密碼檔案是清楚的。)

asp.net伺服器控制項:

asp:label控制項:

說白了,這個傻瓜控制項就是為了程式碼與html代碼完全分離用的,它的作用是預先編譯並產生與字元有關的一些特定位置顯示的文字。他的作用就象html中的span或者div,下面看看它的屬性。

首先應該是runat,顯然它屬於asp.net的控制項,自然只能是runat=“server“。

其餘的屬性有以下幾個:

BackColor , ForeColor , Height , ID , Text , Visible , Width ,都很好理解,不用多說。

asp:dropdownlist控制項

首先看它的正常使用。

<form runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem value="123">項目1</asp:ListItem>
<asp:ListItem value="23234">項目2</asp:ListItem>
<asp:ListItem value="453">項目3</asp:ListItem>
</asp:DropDownList>
</form>

我們知道它和html中的select-option標籤功能相同,不同的是它運行在伺服器端,編譯後產生html標籤。

asp:listbox控制項

正常使用:

<form runat="server">
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="multiple">
<asp:ListItem value="4324">項目1</asp:ListItem>
<asp:ListItem value="23432">項目3</asp:ListItem>
<asp:ListItem value="565">項目4</asp:ListItem>
<asp:ListItem value="467567">項目2</asp:ListItem>
</asp:ListBox>
</form>

其中SelectionMode="multiple"說明其是否允許多選。它與asp:DropDownListj幾乎一樣的功能,差別只是它不能下拉。

asp:TextBox控制項:

正常使用:

<asp:TextBox ID="TextBox1" Text="123" Rows="3" Columns="2" ToolTip="21" MaxLength="22" TextMode="MultiLine" runat="server" />

textmode屬性:一行,不設其值;多行,屬性為multiline;如果輸入密碼,則屬性為password.

rows屬性:指定文本也行數。只有textmode屬性設成multiline時,這裡才有效。

Columns屬性:指定文本的列數。

asp:radiobutton & asp:radiobuttonlist控制項:

使用:

<asp:RadioButton ID="RadioButton1" Text="25" TextAlign="left" runat="server" />

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem value="122">項目1</asp:ListItem>
<asp:ListItem value="222">項目2</asp:ListItem>
<asp:ListItem value="333">項目3</asp:ListItem>
</asp:RadioButtonList>

asp:radiobutton有一個groupname屬性,轉換成html就是其name屬性。

asp:CheckBox & asp:CheckBoxList

<asp:CheckBox ID="CheckBox1" Text="mmbvn" runat="server" />

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem value="bn ">項目1</asp:ListItem>
<asp:ListItem value=" nb">項目2</asp:ListItem>
</asp:CheckBoxList>

屬性與前面大同小異。

表單的幾種:



asp.net的響應:



form在asp.net中的工作方式:

伺服器控制項實際上是在伺服器上動態產生的,然後發送出去。

標記是:<form runat=“server“>

所有的asp.net的表單都是使用post方式進行傳遞的。

asp.net的表單是有狀態的,前翻如果有表單,而且你曾經輸入過內容時候,其內容是保留的;而html表單是無狀態的,不能做到這一點。(實際過程中,html表單也能在短暫的時間具有這一功能,只是密碼檔案是清楚的。)

asp.net伺服器控制項:

asp:label控制項:

說白了,這個傻瓜控制項就是為了程式碼與html代碼完全分離用的,它的作用是預先編譯並產生與字元有關的一些特定位置顯示的文字。他的作用就象html中的span或者div,下面看看它的屬性。

首先應該是runat,顯然它屬於asp.net的控制項,自然只能是runat=“server“。

其餘的屬性有以下幾個:

BackColor , ForeColor , Height , ID , Text , Visible , Width ,都很好理解,不用多說。

asp:dropdownlist控制項

首先看它的正常使用。

<form runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem value="123">項目1</asp:ListItem>
<asp:ListItem value="23234">項目2</asp:ListItem>
<asp:ListItem value="453">項目3</asp:ListItem>
</asp:DropDownList>
</form>

我們知道它和html中的select-option標籤功能相同,不同的是它運行在伺服器端,編譯後產生html標籤。

asp:listbox控制項

正常使用:

<form runat="server">
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="multiple">
<asp:ListItem value="4324">項目1</asp:ListItem>
<asp:ListItem value="23432">項目3</asp:ListItem>
<asp:ListItem value="565">項目4</asp:ListItem>
<asp:ListItem value="467567">項目2</asp:ListItem>
</asp:ListBox>
</form>

其中SelectionMode="multiple"說明其是否允許多選。它與asp:DropDownListj幾乎一樣的功能,差別只是它不能下拉。

asp:TextBox控制項:

正常使用:

<asp:TextBox ID="TextBox1" Text="123" Rows="3" Columns="2" ToolTip="21" MaxLength="22" TextMode="MultiLine" runat="server" />

textmode屬性:一行,不設其值;多行,屬性為multiline;如果輸入密碼,則屬性為password.

rows屬性:指定文本也行數。只有textmode屬性設成multiline時,這裡才有效。

Columns屬性:指定文本的列數。

asp:radiobutton & asp:radiobuttonlist控制項:

使用:

<asp:RadioButton ID="RadioButton1" Text="25" TextAlign="left" runat="server" />

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem value="122">項目1</asp:ListItem>
<asp:ListItem value="222">項目2</asp:ListItem>
<asp:ListItem value="333">項目3</asp:ListItem>
</asp:RadioButtonList>

asp:radiobutton有一個groupname屬性,轉換成html就是其name屬性。

asp:CheckBox & asp:CheckBoxList

<asp:CheckBox ID="CheckBox1" Text="mmbvn" runat="server" />

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem value="bn ">項目1</asp:ListItem>
<asp:ListItem value=" nb">項目2</asp:ListItem>
</asp:CheckBoxList>

屬性與前面大同小異。

表單的幾種:



asp.net的響應:



form在asp.net中的工作方式:

伺服器控制項實際上是在伺服器上動態產生的,然後發送出去。

標記是:<form runat=“server“>

所有的asp.net的表單都是使用post方式進行傳遞的。

asp.net的表單是有狀態的,前翻如果有表單,而且你曾經輸入過內容時候,其內容是保留的;而html表單是無狀態的,不能做到這一點。(實際過程中,html表單也能在短暫的時間具有這一功能,只是密碼檔案是清楚的。)

asp.net伺服器控制項:

asp:label控制項:

說白了,這個傻瓜控制項就是為了程式碼與html代碼完全分離用的,它的作用是預先編譯並產生與字元有關的一些特定位置顯示的文字。他的作用就象html中的span或者div,下面看看它的屬性。

首先應該是runat,顯然它屬於asp.net的控制項,自然只能是runat=“server“。

其餘的屬性有以下幾個:

BackColor , ForeColor , Height , ID , Text , Visible , Width ,都很好理解,不用多說。

asp:dropdownlist控制項

首先看它的正常使用。

<form runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem value="123">項目1</asp:ListItem>
<asp:ListItem value="23234">項目2</asp:ListItem>
<asp:ListItem value="453">項目3</asp:ListItem>
</asp:DropDownList>
</form>

我們知道它和html中的select-option標籤功能相同,不同的是它運行在伺服器端,編譯後產生html標籤。

asp:listbox控制項

正常使用:

<form runat="server">
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="multiple">
<asp:ListItem value="4324">項目1</asp:ListItem>
<asp:ListItem value="23432">項目3</asp:ListItem>
<asp:ListItem value="565">項目4</asp:ListItem>
<asp:ListItem value="467567">項目2</asp:ListItem>
</asp:ListBox>
</form>

其中SelectionMode="multiple"說明其是否允許多選。它與asp:DropDownListj幾乎一樣的功能,差別只是它不能下拉。

asp:TextBox控制項:

正常使用:

<asp:TextBox ID="TextBox1" Text="123" Rows="3" Columns="2" ToolTip="21" MaxLength="22" TextMode="MultiLine" runat="server" />

textmode屬性:一行,不設其值;多行,屬性為multiline;如果輸入密碼,則屬性為password.

rows屬性:指定文本也行數。只有textmode屬性設成multiline時,這裡才有效。

Columns屬性:指定文本的列數。

asp:radiobutton & asp:radiobuttonlist控制項:

使用:

<asp:RadioButton ID="RadioButton1" Text="25" TextAlign="left" runat="server" />

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem value="122">項目1</asp:ListItem>
<asp:ListItem value="222">項目2</asp:ListItem>
<asp:ListItem value="333">項目3</asp:ListItem>
</asp:RadioButtonList>

asp:radiobutton有一個groupname屬性,轉換成html就是其name屬性。

asp:CheckBox & asp:CheckBoxList

<asp:CheckBox ID="CheckBox1" Text="mmbvn" runat="server" />

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem value="bn ">項目1</asp:ListItem>
<asp:ListItem value=" nb">項目2</asp:ListItem>
</asp:CheckBoxList>

屬性與前面大同小異。

表單的幾種:



asp.net的響應:



form在asp.net中的工作方式:

伺服器控制項實際上是在伺服器上動態產生的,然後發送出去。

標記是:<form runat=“server“>

所有的asp.net的表單都是使用post方式進行傳遞的。

asp.net的表單是有狀態的,前翻如果有表單,而且你曾經輸入過內容時候,其內容是保留的;而html表單是無狀態的,不能做到這一點。(實際過程中,html表單也能在短暫的時間具有這一功能,只是密碼檔案是清楚的。)

asp.net伺服器控制項:

asp:label控制項:

說白了,這個傻瓜控制項就是為了程式碼與html代碼完全分離用的,它的作用是預先編譯並產生與字元有關的一些特定位置顯示的文字。他的作用就象html中的span或者div,下面看看它的屬性。

首先應該是runat,顯然它屬於asp.net的控制項,自然只能是runat=“server“。

其餘的屬性有以下幾個:

BackColor , ForeColor , Height , ID , Text , Visible , Width ,都很好理解,不用多說。

asp:dropdownlist控制項

首先看它的正常使用。

<form runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem value="123">項目1</asp:ListItem>
<asp:ListItem value="23234">項目2</asp:ListItem>
<asp:ListItem value="453">項目3</asp:ListItem>
</asp:DropDownList>
</form>

我們知道它和html中的select-option標籤功能相同,不同的是它運行在伺服器端,編譯後產生html標籤。

asp:listbox控制項

正常使用:

<form runat="server">
<asp:ListBox ID="ListBox1" runat="server" SelectionMode="multiple">
<asp:ListItem value="4324">項目1</asp:ListItem>
<asp:ListItem value="23432">項目3</asp:ListItem>
<asp:ListItem value="565">項目4</asp:ListItem>
<asp:ListItem value="467567">項目2</asp:ListItem>
</asp:ListBox>
</form>

其中SelectionMode="multiple"說明其是否允許多選。它與asp:DropDownListj幾乎一樣的功能,差別只是它不能下拉。

asp:TextBox控制項:

正常使用:

<asp:TextBox ID="TextBox1" Text="123" Rows="3" Columns="2" ToolTip="21" MaxLength="22" TextMode="MultiLine" runat="server" />

textmode屬性:一行,不設其值;多行,屬性為multiline;如果輸入密碼,則屬性為password.

rows屬性:指定文本也行數。只有textmode屬性設成multiline時,這裡才有效。

Columns屬性:指定文本的列數。

asp:radiobutton & asp:radiobuttonlist控制項:

使用:

<asp:RadioButton ID="RadioButton1" Text="25" TextAlign="left" runat="server" />

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem value="122">項目1</asp:ListItem>
<asp:ListItem value="222">項目2</asp:ListItem>
<asp:ListItem value="333">項目3</asp:ListItem>
</asp:RadioButtonList>

asp:radiobutton有一個groupname屬性,轉換成html就是其name屬性。

asp:CheckBox & asp:CheckBoxList

<asp:CheckBox ID="CheckBox1" Text="mmbvn" runat="server" />

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem value="bn ">項目1</asp:ListItem>
<asp:ListItem value=" nb">項目2</asp:ListItem>
</asp:CheckBoxList>

屬性與前面大同小異。



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.