HTML中ImageButton1无法调用cs中ImageButton1_Click事件

问题描述

asp:<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="login.aspx.cs"Inherits="QQLoginAouth2.login"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>无标题页</title></head><body><formid="form1"runat="server"><divstyle="width:1366px;background:#fff"align="center"><divstyle="width:430px;border-right:1pxsolid#d9d9d9;border-left:1pxsolid#d9d9d9"><tablealign="center"><tr><td><br/><br/><br/><imgsrc="images/school/52school350200.jpg"alt=""style="height:109px;width:228px"/></td></tr><tr><tdalign="center"><asp:ImageButtonID="ImageButton2"runat="server"ImageUrl='images/school/Connect_logo_4.png'OnClick="ImageButton1_Click"Height="32px"Width="170px"/></td></tr></table></div></div></form></body></html>asp.csusingSystem;usingSystem.Text;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingNewtonsoft.Json;namespaceQQLoginAouth2{publicpartialclasslogin:System.Web.UI.Page{privatereadonlystringclient_id=Utils.GetAppSeting("qzone_AppID");privatereadonlystringclient_secret=Utils.GetAppSeting("qzone_AppKey");privatereadonlystringredirect_uri=Utils.GetAppSeting("qzone_Redirect_uri");privatestringstate="";protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidImageButton1_Click(objectsender,ImageClickEventArgse){state=Guid.NewGuid().ToString().Replace("-","");//Utils.WriteCookie("state",state,60);HttpContext.Current.Session["state"]=state;stringlogin_url="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id="+client_id+"&state="+state+"&redirect_uri="+Utils.UrlEncode(redirect_uri)+"&scope=get_user_info,get_info,get_other_info";//写日志Logs.logSave("===========================================分割线=============================================");//写日志Logs.logSave("第一步:开始跳转至QQ登陆URL:"+login_url);//开始发送HttpContext.Current.Response.Redirect(login_url);}}}提示:双击ImageButton1_Click,结果无法调用cs方法编译器错误消息:CS1061:“ASP.login_aspx”不包含“ImageButton1_Click”的定义,并且找不到可接受类型为“ASP.login_aspx”的第一个参数的扩展方法“ImageButton1_Click”(是否缺少using指令或程序集引用?)源错误:行24:</td></tr>行25:行26:<tr><tdalign="center"><asp:ImageButtonID="ImageButton2"runat="server"行27:ImageUrl='images/school/Connect_logo_4.png'OnClick="ImageButton1_Click"Height="32px"行28:Width="170px"/></td></tr>

解决方案

本帖最后由 ytzhangyanghuan 于 2015-01-07 11:12:08 编辑
解决方案二:
login.aspx.cs“ASP.login_aspx”检查一下文件名吧,感觉没对应上啊
解决方案三:
不是这个问题,主要是html中的控件无法直接调用asp.cs的方法,当是我也不知道如何解决。

时间: 2024-08-02 18:01:28

HTML中ImageButton1无法调用cs中ImageButton1_Click事件的相关文章

asp.net中前台如何调用.cs方法

问题描述 asp.net中前台如何调用.cs方法 问题如题,我在.cs文件里写了处理数据库的一个方法,前台该如何调用这个方法~ 解决方案 <% 方法(); %> 解决方案二: http://blog.csdn.net/chinacsharper/article/details/9400331 解决方案三: JS中__doPostBack用法: http://www.cnblogs.com/fulai/p/3328670.html

以前收集的一些资料---如何在ASP中通过ODBC调用Excel中的数据

excel|odbc|数据                如何在ASP中通过ODBC调用Excel中的数据    在ASP中通过ODBC调用Excel中的数据方式和普通的通过ODBC调用数据库的方式有一些不同的地方.下面将介绍如何通过ODBC在ASP中使用Excel的数据.    在使用的过程中,要注意的是你需要使用的ODBC驱动为:Microsoft ODBC Driver for Excel. 下面给出一个例子来具体说明如何调用的过程:1.在Excel的电子表格中新建一个叫Range的表单a

link中是不是只能调用sqlfunctions中的函数?能不能给sqlfunctions增加函数?

问题描述 link中是不是只能调用sqlfunctions中的函数?能不能给sqlfunctions增加函数? link中是不是只能调用sqlfunctions中的函数?能不能给sqlfunctions增加函数? 解决方案 可以调用自定义函数,不过前提是函数要在sql里面实现 参考:http://www.cnblogs.com/lyj/archive/2008/03/19/1112356.html 否则只能先用AsEnumerable转换成Linq to Objects,再执行.

如何在ASP中通过ODBC调用Excel中的数据

excel|odbc|数据 http://www.chinaasp.com/ 在ASP中通过ODBC调用Excel中的数据方式和普通的通过ODBC调用数据库的方式有一些不同的地方.下面将介绍如何通过ODBC在ASP中使用Excel的数据. 在使用的过程中,要注意的是你需要使用的ODBC驱动为:Microsoft ODBC Driver for Excel. 下面给出一个例子来具体说明如何调用的过程:1.在Excel的电子表格中新建一个叫Range的表单a)在Excel文件ADOtest.xls中

.net中参数从aspx.cs中传接到aspx中作为SQL语句参数???

问题描述 .net中参数从aspx.cs中传接到aspx中作为SQL语句参数???在detail.aspx.cs中我定义了全局变量protectedintno;在detail.aspx.cs进行处理后打算传到detail.aspx界面中作为访问数据库的参数,以下是detail.aspx中的一段代码:<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$Co

急难:win中webBrowser可以调用web中的javascript,但怎么调用web框架集中子框架(frame)的javascript?

问题描述 如题:webBrowser可以调用web中通过:webBrowser1.Document.InvokeScript("jsfunction").ToString();来交互,并获得函数值问题:怎么webBrowser怎么调用web框架集中子框架(frame)中的javascript函数?来获得javascript函数传递的值? 解决方案 解决方案二:document.frames["framsId"].document.jsFunction();

如何将一个partialView传入一个View中,并调用View中的JS方法?

问题描述 是这样的,我要实现的功能如下:1.点击View"ManageEmployee"中的"AddEmployee",通过Ajax调用后台的partialView"_AddEmp",使用一个回调方法使返回来的partialView显示在一个dialog中.2.partialView中是一个表单,如果表单成功提交就重定向到其他页面,如果提交失败就保持partialView显示在dialog中.1已经实现,2的话现在不知道如何将partialvie

VS2008中JS怎么调用CS函数 不知道AJAX的使用和以前一样吗?谢谢

问题描述 RT 解决方案 解决方案二:f解决方案三:和05中的区别应该不大吧解决方案四:最好的办法就是在vs08中试一下解决方案五:Ajax,一样的解决方案六:用<%=result%>这种方式!result为函数返回值解决方案七:一样解决方案八:用着不习惯谢谢大家能不能再具体点

java类中如何直接调用JSP中定义的bean实例

问题描述 在JSP页面中,定义了<jsp:useBeanid="pool"scope="application"class="dataConnPool.PoolBean"/>然后在编写一个java类,里面想直接调用jsp页面中的pool实例,怎么做? 解决方案 解决方案二:这个需求都被你想出来了请问你要做什么呢解决方案三:看一下tlt文件.