後端抓取非asp控制項之內容

之前都以為前端一定要是asp控制項(工具列中拉出來的<asp:開頭控制項)才可以在後端讀取,但其實一般Html標籤的控制項也可以,以下為範例

 

前端:

<form runat="server">
   <div id="listfunction">
      <select name="DDLCaseStatus" id="DDLCaseStatus"  runat="server" >
         <option value="All">全部信件</option>
         <option value="Processing">處理中信件</option>

      </select>
    
      <input type="text" runat="server" name="TXTSearchValue"  id="TXTSearchValue"/>
      <asp:Button ID="BTNSearch" runat="server"  ClientIDMode="Static" Text="查詢" OnClick="BTNSearch_Click" />
   </div>
</form>

後端:

protected void BTNSearch_Click(object sender, EventArgs e)
{

    var caseStatus = this.DDLCaseStatus.Value;
    var searchValue = this.TXTSearchValue.Value;
}