Tony's Blogger
2019年3月12日 星期二
C# MVC 清空文字方塊
使用 ModelState.clear() 把 model 中的資料清空,同步地也會清空 view 上文字方塊的資料。
public
ActionResult
Index
()
{
return
View
();
}
[
HttpPost
]
public
ActionResult
Index
(
FormCollection
collection
)
{
// 這就會把 Model 中的資料清空
ModelState
.
Clear
();
return
View
();
}
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
remove last word from SQL query
SET @columnSql = SUBSTRING ( @columnSql , 1 , LEN ( @columnSql ) - 1 )
沒有留言:
張貼留言