"风格"显示AJAX弹出窗口(vb.net)时出错
"Style" Error for Displaying AJAX Popup (vb.net)
当我尝试在VB中运行某些代码时遇到错误,我有一些VB代码告诉我的Griview添加一个标签,上面写着"插入电子邮件"在任何不包含电子邮件地址的行的最后一列中:
我还有一些代码,我想在点击Collumn中的标签后打开Ajax模式弹出框:
这是我的更新代码(仍然不起作用):
'----------------------------------------
For i As Integer = 0 To GridView1.Rows.Count - 1
If GridView1.Rows(i).Cells(9).Text = " " Then
Dim lbl As String
lbl = "Insert Email"
GridView1.Rows(i).Cells(9).Text = lbl
e.Row.Cells(9).Attributes("OnMouseOver") = "this.style.textDecoration='underline'; this.style.cursor='hand';"
e.Row.Cells(9).Attributes("OnMouseOut") = "this.style.textDecoration='none';"
e.Row.Cells(9).Attributes.Add("OnClick", "document.getElementById('" + deletePopup.ClientID + "').style.visibility= 'True'")
End If
Next
'----------------------------------------
错误是:
错误:无法获取未定义或空引用的属性"style"
我认为它指的是这条线:
e.Row.Cells(9).Attributes.Add("OnClick", "document.getElementById('deletePopup').Style.Visible = True'")
以下是应该打开的模式弹出窗口的ASPX代码:
<div id="deletePopup" runat="server" class="modalPopup"
style="padding: 2px; width: 396px;" visible="false">
<asp:HiddenField ID="ServiceID" runat="server" />
<asp:HiddenField ID="HiddenDesc" runat="server" />
<asp:Label ID="Label4" runat="server" Text="Type in an Email:"></asp:Label>
<asp:TextBox ID="EmailTextBox1" runat="server" Height="22px" Width="370px"></asp:TextBox>
<asp:Button ID="UpdateEmailBtn" runat="server" Text="Update Email" />
<asp:Button ID="cancelButton" runat="server" Text="Cancel" />
</div>
我希望能得到一些帮助。提前谢谢。。。
我不太确定我输入的代码是否正确。。。
收到您的问题。
我看得出来,你已经使用了以下内容。
<div id="deletePopup" runat="server" class="modalPopup" style="padding: 2px; width: 396px;" visible="false">
使用visible=false
时,将从DOM
中删除deletePopup
元素。
如果此属性为false,则不会呈现服务器控件。-MSDN
由于这在DOM中不存在,您将得到错误-Unable to get property 'style' of undefined
。若要使用javascript使其可见,则需要仅使用客户端代码(css
)使其隐藏,如下所示。
<div id="deletePopup" runat="server" class="modalPopup" style="padding: 2px; width: 396px;display:none;" >
并使用以下javascript使其可见。
e.Row.Cells(9).Attributes.Add("onclick", "document.getElementById('" + deletePopup.ClientID +"').style.display = 'block'")
附带说明:如果需要使用服务器端代码使其可见,可以使用deletePopup.Visible = True
。
- 铬:“;未捕获的语法错误:意外的标记:"
- 将数据从javascript文件导入VB.Net页面
- 可以设置“;文件名"发生错误时显示的内联脚本标记的
- JS表单提交"无法使用Chrome数据保护程序加载此页面.尝试重新加载页面.调试信息:POST CISmtuK
- 检测电话窃听,即:<a href="电话:xxx">在UIWebview上
- 使用“+="操作人员
- //而不是在src=“”上使用http://"属性
- "未捕获的语法错误:意外的标记}"
- 可以<脚本类型=“;text/javascript”>window.location=“/"</
- "实例范围”;TypeScript类的getter/setter
- Javascript复选框函数:;缺少:在属性id之后"
- "“;变量未引用正确的对象
- "日期“;AJAX请求返回的类型值未定义
- 得到"TypeError:无法读取属性'filename'未定义的“;调用“npm start
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 将javascript正则化为vb
- "工具提示"jQuery插件坏了
- VB NET JQUERY AJAX上出现错误500
- "锻造;React中的表达式
- "风格"显示AJAX弹出窗口(vb.net)时出错