面板DefaultButton doe不起作用 [英] Panel DefaultButton doe not work
本文介绍了面板DefaultButton doe不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的应用程序中嵌套了datalist
我在第二个数据列表中放入此代码
i have nested datalist in my application
the inside the second datalist i put this code
<td>
<asp:Panel ID="Panel1"
runat="server"
DefaultButton="LinkButton2">
<asp:Button ID="comment_btn"
runat="server"
Text="add"
CommandName="btn_comment_add"
CommandArgument='<%#Eval("id") %>'
Style="display: none" />
<asp:LinkButton ID="LinkButton2"
CommandName="LinkButton_2"
CommandArgument='<%#Eval("id") %>'
runat="server"
Style="display: none" >
LinkButton
</asp:LinkButton>
<asp:TextBox ID="txtComment"
runat="server"
Width="400px"
Height="20px"
Visible="false">
</asp:TextBox>
</asp:Panel>
<asp:LinkButton ID="comment_link"
ForeColor="Maroon"
Font-Size="X-Small"
Font-Bold="true"
runat="server"
CommandName="comment_link"
CommandArgument='<%#Eval("id") %>'>
Comment
</asp:LinkButton>
</td>
并使用nokta_datalist_ItemCommand父级datalist访问defualt按钮的事件
and used nokta_datalist_ItemCommand to the parent datalist to access the event of the defualt button
protected void nokta_datalist_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "comment_link")
{
e.Item.FindControl("txtComment").Visible = true;
e.Item.FindControl("comment_btn").Visible = true;
}
if (e.CommandName == "LinkButton_2")
{
//---------- add the user comment to the data base--------------//
Label3.Text = "goooood";
//comment_obj.add_comment("helooooo", Convert.ToInt16(Session["user_id"].ToString()),Convert.ToInt16(e.CommandArgument));
}
}
当我使用调试时
when i use debug
the
if (e.CommandName == "LinkButton_2")
{
}
里面的代码没有执行且没有错误
}
the code inside it does not execute and there is no error
推荐答案
来自 Panel.DefaultButton属性 [ ^ ]:
以下情况不支持设置DefaultButton属性:
•引用作为LinkButton控件的默认按钮。仅支持Button和ImageButton控件。
From the Panel.DefaultButton Property [^]:
Setting the DefaultButton property is not supported for the following scenarios:
• Referencing a default button that is a LinkButton control. Only Button and ImageButton controls are supported.
这篇关于面板DefaultButton doe不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文