在网页上检查空控件时出现警报框 [英] Alert boxes when checking for empty controls on the web page

查看:73
本文介绍了在网页上检查空控件时出现警报框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好-

我真的很困惑.我使用Microsoft.Samples.Alert找到了一个示例,然后打开提供的Alert.aspx页面,一切正常.

当我将dll导入到我的项目中时,将脚本代码复制到我的aspx页面中,它无法识别该代码,并且我还注意到,在所提供的aspx页面中,该页面的左上方可以从中进行选择''客户对象和事件",它具有服务器代码,并显示我正在尝试创建的警报.我无法弄清我所缺少的.

这是我复制到aspx.page
中的代码

Hi All --

I really confused. I found an example using Microsoft.Samples.Alert and I open the Alert.aspx page provided and everything works fine.

When I import the dll into my project, copy the script code into my aspx page, it doesn''t recognize the code and I also notice that in the aspx page provided, on the top left of page where you can pick from ''Client Objects & Events'', it has Server Code and it shows the alerts I''m trying to create. I can''t figure out what I''m missing.

Here is the code I''m copying into my aspx.page

<%@ Register Namespace="Microsoft.Samples.Alert" TagPrefix="ms" Assembly="Alert" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
    public void ServerShow(object sender, EventArgs e)
    {
        ServerAlert.Show();
    }
    public void ServerAlertChoice(object sender, AlertChoiceEventArgs e)
    {
        AlertResult.Text = "You clicked " + e.Result.ToString();
        AlertResult.Visible = true;
    }
    public void ConfirmClick(object sender, EventArgs e) {
        ConfirmResult.Visible = true;
    }
</script>




我有alert.dll&我的bin目录中的Alert.pdb,我使用添加引用/浏览"将其添加了

当我复制完全相同的代码时,所有内容都以蓝色加下划线,并且错误如下:

名称"ServerAlert"在当前上下文中不存在
Microsoft.Samples.Alert.AlertResult不包含Text的定义
可见的""


我想念什么?它必须很简单!我正在使用Visual Web Developer 2008 Express

谢谢!




I have the alert.dll & Alert.pdb in my bin directory and I added it using ''Add references/browse''

When I copy the exact same code, everything is underlined in blue and the errors are:

The name ''ServerAlert'' does not exist in the current context
Microsoft.Samples.Alert.AlertResult does not contain a definition for Text
""" for Visible
etc.

What am I missing? It''s got to be simple! I''m using Visual Web Developer 2008 Express

Thanks!

推荐答案

您确定添加了以下代码吗?我能看到它为什么出错的唯一原因是基于ASP.Net博客网站的示例代码,您的编译器引用的是AlertResult程序集,而不是应该添加的标签控件.
Are you sure you added the following code? The only reason I can see why it errored is because your compiler is referring to the AlertResult assembly rather than the label control which is supposed to be added, based on the sample code from ASP.Net blogsite.
<asp:Label ID="AlertResult" runat="server" ForeColor="Red" Visible="false" />


我使用了 http://weblogs.asp.net/bleroy/archive/2005/12/01/432016.aspx [ ^ ]作为参考.


I used http://weblogs.asp.net/bleroy/archive/2005/12/01/432016.aspx[^] as a reference.


这篇关于在网页上检查空控件时出现警报框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆