---
# System prepended metadata

title: 0922 - 把 button submit 到 post
tags: [雄獅資訊]

---

---
tags: ASP.NET MVC 5.X
---
# 0922 - 把 button submit 到 post，
## 參考 SearchList 的 post form

### 定義 會員資料查詢的 Model 


![](https://hackmd.io/_uploads/S18l4Zh1a.png)

### 解析包裝成 post 的 form：Views＼Etkt10＼SearchList.cshtml


![](https://hackmd.io/_uploads/S1dmwAoyT.png)

![](https://hackmd.io/_uploads/ByXSY-hk6.png)


![](https://hackmd.io/_uploads/H1dsWz3y6.png)


#### 搜尋按鈕：
![](https://hackmd.io/_uploads/S11Iv0oka.png)

![](https://hackmd.io/_uploads/HJc8dAok6.png)


### 搜尋按鈕 所觸發 JavaScript 事件： Scripts＼Etkt10＼SearchList.js

### /Scripts/Etkt10/SearchList.js?　@Model.FullDateTimeNumber"　？？

> onclick="_ButtonClient_onClick(this)"

![](https://hackmd.io/_uploads/Bkz9n0okp.png)

![](https://hackmd.io/_uploads/B1z8TRj1a.png)

### id 名稱_JS事件()

![](https://hackmd.io/_uploads/ryLC0g3kp.png)

![](https://hackmd.io/_uploads/HJXEDE2ya.png)

![](https://hackmd.io/_uploads/BkYyuE31p.png)

### Action 的 GET 與 POST

![](https://hackmd.io/_uploads/HknV_431p.png)


#### [HttpPost]

![](https://hackmd.io/_uploads/Skqx_Vnya.png)


###  會員資料搜尋結果



![](https://hackmd.io/_uploads/SkHCIP0kT.png)


```
@using (Html.BeginPager(Model.PageIndex, Model.PageSize, Model.RowCount))
{
<table id="SearchListTable" class="tblzebra">
    <tr>
        <!--會員姓名-->
        <th nowrap="nowrap" class="text-center">
            會員姓名
        </th>
        <!--性別-->
        <th nowrap="nowrap" class="text-center">
            性別
        </th>
        <!--生日-->
        <th nowrap="nowrap" class="text-center">
            生日
        </th>
        <!--身分證字號-->
        <th nowrap="nowrap" class="text-center">
            身分證字號
        </th>
        <!--手機號碼-->
        <th nowrap="nowrap" class="text-center">
            手機號碼
        </th>
        <!--國家/城市-->
        <th nowrap="nowrap" class="text-center">
            國家/城市
        </th>
        <!--地址-->
        <th nowrap="nowrap" class="text-center">
            地址
        </th>
    </tr>
    @foreach (var item in Model.lstMember)
    {
        <tr>
            <td nowrap="nowrap" class="text-center">

                @item.Name
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Gender
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Birth
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Identify
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Phone
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Country
            </td>
            <td nowrap="nowrap" class="text-center">
                @item.Address
            </td>

        </tr>
    }
</table>
 

}




```


## [InputType(EnumInputType.Other)]

![](https://hackmd.io/_uploads/r16yaiAya.png)


### 生日

![](https://hackmd.io/_uploads/SyJQduCkT.png)


### 身分證字號

![](https://hackmd.io/_uploads/HklB_ORka.png)


### 性別

#### Model

![](https://hackmd.io/_uploads/HJCvGFCkp.png)

#### View

![](https://hackmd.io/_uploads/SJldQFCJp.png)

![](https://hackmd.io/_uploads/H1-YQt0kT.png)


## [BasicCodeType(EnumBasicCodeType.Other)]

![](https://hackmd.io/_uploads/BJ22aoR1p.png)


### 國家

### 城市

### 作廢


-----

### 觀念補充:

### 表單中的 GET 與 POST


 