Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当javascript调用ModalPopupXtender时,其ID和BehaviorID返回null_C#_Javascript_Asp.net_Gridview_Modalpopupextender - Fatal编程技术网

C# 当javascript调用ModalPopupXtender时,其ID和BehaviorID返回null

C# 当javascript调用ModalPopupXtender时,其ID和BehaviorID返回null,c#,javascript,asp.net,gridview,modalpopupextender,C#,Javascript,Asp.net,Gridview,Modalpopupextender,我已按如下方式初始化我的MPE: <asp:modalpopupextender ID ="ModalPopupExtender1" BehaviorID ="ModalBehavior" runat ="server" OkControlID ="btnCancel"

我已按如下方式初始化我的MPE:

<asp:modalpopupextender ID                  ="ModalPopupExtender1"
                    BehaviorID          ="ModalBehavior"
                    runat               ="server"
                    OkControlID         ="btnCancel"
                    CancelControlID     ="btnCancel"
                    TargetControlID     ="dead"
                    PopupControlID      ="Panel1"
                    BackgroundCssClass  ="ModalPopupBG"/>
然后,我将onclick属性分配给gridview行以调用
mpe.Show

开关(如Row.RowType)
{
案例DataControlRowType.DataRow:
e、 添加(“onmouseover”,“this.style.cursor='hand'”);
e、 添加(“onclick”、“ShowPopup()”;
打破
母版页中的My
ShowPopup()
函数:

函数ShowPopup(){
变量mpe=$find('ModalBehavior');
mpe.show()
}
我尝试过许多方法,试图在单击GridView行时生成除空值以外的任何值,但它们都不起作用。例如:

开关(如Row.RowType)
{
案例DataControlRowType.DataRow:
e、 添加(“onmouseover”,“this.style.cursor='hand'”);
e、 Add(“onclick”,String.Format(“javascript:$find('{0}').show();”,ModalPopupExtender1.ClientID));
打破
还有这个

String.Format(“javascript:$find('{0}').show();”,ModalPopupExtender1))
Format(“javascript:$find('{0}').show();”,ModalBehavior))
单击gridview行时,出现以下错误:

错误:“null”为null或不是对象

我还尝试实施:

函数pageLoad(){
变量mpe=$find('ModalBehavior');
mpe.show();
调试器;
$find('ModalBehavior')。添加(
函数(){
警报(“将显示模式弹出窗口”);
}
);
}

但是得到了同样的结果。任何帮助都将不胜感激。

不确定这是否有效;您是否尝试过ModalPopupExtender1.ClientID?!
<asp:Button id="dead" runat="server"/>