zoukankan      html  css  js  c++  java
  • WAP版浏览器不支持.NET的linkButton

    在我们网站FOR WAP版的某个页面上放了两个LinkButton,结果用手机自带的WAP浏览器看的时候,提示 通信协议不支持。


    改成 Button 就可以了。

    ImageButton的话,点击不会报错,页面虽然刷新,但没有执行相应的事件。不过页面确实是有提交的,只是没有跟ImageButton的事件挂钩。可以在Page_Load里查出是哪个控件触发了提交,如果发现是这个ImageButton的话,就执行它的事件。关键是怎么找出是谁触发了提交。

    查找代码如下:

        string GetPostBackControlName()
        {
            Control control = null;
            string ctrlname = Page.Request.Params["__EVENTTARGET"];
            if (ctrlname != null && ctrlname != String.Empty)
            {
                control = Page.FindControl(ctrlname);
            }
            else
            {
                Control c;
                foreach (string ctl in Page.Request.Form)
                {
                    if (ctl.EndsWith(".x") || ctl.EndsWith(".y"))
                    {
                        c = Page.FindControl(ctl.Substring(0, ctl.Length - 2));
                    }
                    else
                    {
                        c = Page.FindControl(ctl);
                    }
                    if (c is System.Web.UI.WebControls.Button ||
                             c is System.Web.UI.WebControls.ImageButton)
                    {
                        control = c;
                        break;
                    }
                }
            }
            if (control != null)
                return control.ID;
            else
                return string.Empty;
        }



  • 相关阅读:
    线程同步(二)—— 条件变量
    线程同步(一)—— 互斥锁
    进程同步(四)—— 消息队列
    Nginx反向代理服务器的配置
    散列表(hash表)
    浅谈bitmap
    进程空间分配和堆栈大小
    拓扑排序
    归并排序
    快速排序
  • 原文地址:https://www.cnblogs.com/leftfist/p/4258038.html
Copyright © 2011-2022 走看看