发布评论时如何确定答案的ID? [英] How to determine the ID of the answer when a comment is posted?

查看:62
本文介绍了发布评论时如何确定答案的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户发布特定答案的评论时,如何在stackoverflow或codeproject网站上发布评论时,如何获取已发布答案的ID。假设有一个Datalist,它显示特定问题的3个答案,每个答案都有一个评论按钮。



我尝试过:



试图搞清楚但无法得到它......

解决方案

< blockquote>你的问题太模糊,没有任何真正的意义或给出具体的答案。通常在给出回复功能时,如果回复选项是链接,则您回复的帖子的ID将在查询字符串上传递;



reply.aspx ?postid = 123



或者如果它是一个按钮,那么你可以将按钮放在ID为

的表格中>

 <  表格    action   = 回复.aspx   方法  = 发布 >  
< 输入 type = 隐藏 name = postid value = 123 / >
< input type = 提交 = 回复 / >
< / form >





或者如果它是由ajax完成的,那么你将有一些其他机制来传递id。


How to get the ID of the posted answer when the user post a comment for a particular answer just like posting comments on stackoverflow or codeproject sites. Assume that there is a Datalist and it is displaying 3 answers for a particular question and each answer is having a comment button.

What I have tried:

Tried to figure it out but could not get it......

解决方案

Your question is too vague to make any real sense or give a concrete answer. Normally when giving a reply function, the id of the post you are replying to is passed on the querystring if the "reply" option is a link;

reply.aspx?postid=123

or if it is a button then you can put the button in a form that has the id

<form action="reply.aspx" method="post">
    <input type=hidden name=postid value="123"/>
    <input type=submit value="Reply"/>
</form>



Or if it's done by ajax then you'll have some other mechanism to pass the id.


这篇关于发布评论时如何确定答案的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆