[英]microsoft jscript runtime error 'btn_click' is undefined
Using Jquery I was able to pop up a dialog window using a link button and it's nothing but the div tag being popped up. 使用Jquery,我能够使用链接按钮弹出一个对话框窗口,不过只是弹出了div标签。
The pop up window consists of a TextBox and button. 弹出窗口由一个TextBox和一个按钮组成。
This is the button coded in *.aspx file: 这是* .aspx文件中编码的按钮:
<asp:Button ID="btnSubmitComment" runat="server" onclick="btnSubmitComment_Click" style="display:none;" />
In Jquery : 在Jquery中:
$(function () {
var dlg = $("#divEditComment").dialog({
autoOpen: false,
show: "blind",
hide: "blind",
//height: 200,
minWidth: 220,
//position: ['right', 210],
buttons: {
"Update Note": function () {
var Updates = btnSubmitComment.replace(/_/g, '$');
__doPostBack(Updates, '');
}
}
});
dlg.parent().appendTo(jQuery("form:first"));
});
divEditComment
is the div tag which acts as dialog box. divEditComment
是用作对话框的div标签。 In this dialog box, the button which is not working exists. 在此对话框中,存在不起作用的按钮。
In C# code-behind, I have declared: 在C#后台代码中,我声明了:
protected void btnSubmitComment_Click(object sender, EventArgs e)
{
}
Still I am getting the error: 仍然我得到错误:
microsoft jscript runtime error 'btnSubmitComment' is undefined
Microsoft JScript运行时错误“ btnSubmitComment”未定义
I am not understanding where I'm wrong. 我不明白我在哪里错。
If you need the id of an asp.net control you can use <%= btnSubmitComment.ClientId %> which will be replaced by asp.net to btnSubmitComment's id, for example: 如果需要asp.net控件的ID,则可以使用<%= btnSubmitComment.ClientId%>,它将由asp.net替换为btnSubmitComment的ID,例如:
var btnSubmitComment = $('#<%= btnSubmitComment.ClientId %>')
will get btnSubmitComment as a jQuery object. 将btnSubmitComment作为jQuery对象。
or using only jQuery: 或仅使用jQuery:
var btnSubmitComment = $('[id$=btnSubmitComment]');
var id = btnSubmitComment.attr('id');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.