请教大师们,Repetear里的button事件为何不响应?
点击之后根本不跑protectedvoidRepeater2_ItemCommand(objectsource,RepeaterCommandEventArgse){st...
点击之后根本不跑
protected void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string temp = e.CommandArgument.ToString();
string[] estr = e.CommandArgument.ToString().Split(',');
int reviewid = Convert.ToInt32(estr[0]);
int isconfirm = Convert.ToInt32(estr[1]);
//string A_id = e.CommandArgument.ToString();
string cmd = e.CommandName;
string[] Columns = {"Q_Status","Q_Isthebest"};
object[] Values = {1,true};
if (cmd == "deal")
{
if (Iqist.updateQuestions(Columns, Values, "where Q_ID="+isconfirm))
{
string[] col = { "A_Isthebest" };
object[] value={true};
Ialist.UpdateAnswer(col,value,"a_id="+reviewid);
Response.Write("<script>alert('OK')</script>");
}
}
<asp:Repeater ID="Repeater2" runat="server"
onitemcommand="Repeater2_ItemCommand">
<ItemTemplate>
<li>
<%#Eval("A_Content")%>
</li>
<li>
回答内容: <%#Eval("A_Createtime") %>>
</li>
<li>
<asp:Button ID="Button1" runat="server" Text="采纳为答案" CommandArgument='<%# Eval("A_ID")+","+Eval("A_Questionid")%>' CommandName="deal" />
</li>
</ItemTemplate>
</asp:Repeater> 展开
protected void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string temp = e.CommandArgument.ToString();
string[] estr = e.CommandArgument.ToString().Split(',');
int reviewid = Convert.ToInt32(estr[0]);
int isconfirm = Convert.ToInt32(estr[1]);
//string A_id = e.CommandArgument.ToString();
string cmd = e.CommandName;
string[] Columns = {"Q_Status","Q_Isthebest"};
object[] Values = {1,true};
if (cmd == "deal")
{
if (Iqist.updateQuestions(Columns, Values, "where Q_ID="+isconfirm))
{
string[] col = { "A_Isthebest" };
object[] value={true};
Ialist.UpdateAnswer(col,value,"a_id="+reviewid);
Response.Write("<script>alert('OK')</script>");
}
}
<asp:Repeater ID="Repeater2" runat="server"
onitemcommand="Repeater2_ItemCommand">
<ItemTemplate>
<li>
<%#Eval("A_Content")%>
</li>
<li>
回答内容: <%#Eval("A_Createtime") %>>
</li>
<li>
<asp:Button ID="Button1" runat="server" Text="采纳为答案" CommandArgument='<%# Eval("A_ID")+","+Eval("A_Questionid")%>' CommandName="deal" />
</li>
</ItemTemplate>
</asp:Repeater> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询