【发布时间】:2014-07-09 15:22:42
【问题描述】:
我想在单击按钮时增加属性的值,即当用户单击按钮时,属性 (int) 的值将增加 1。
这是我增加值的代码:
if(IsPost){
if(Request["like"] == forum_topic_id){
//get the value of the forum post id from the button
forumpostid = Request.Form["like"];
var likepostcommand = "UPDATE forum_post SET forum_post_up = forum_post_up + 1 WHERE forum_post_id = @0";
var likepostdata = db.Query(likepostcommand, forumpostid);
}
}
触发这个操作的button是:
<button type="submit" class="btn btn-default" name="like" value="@getforumtopicdetailsdata.forum_thread_id">Like</button>
按钮在表单内。
单击按钮时,属性forum_post_up 的值应增加1 值。
有什么帮助吗?
【问题讨论】:
-
你可以使用ajax调用来完成这个任务
-
你能解释一下吗? @HirenKagrana
标签: sql razor asp.net-webpages