..net文件中的代码不能在asp.net中接受。 [英] Code on .cs file not accept in asp.net.

查看:52
本文介绍了..net文件中的代码不能在asp.net中接受。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET上使用C#创建Web应用程序。设计页面上的代码工作正常但是当我在.cs文件上编写代码时,它无法正常工作。请帮我解决这个问题。

I was create web application on ASP.NET USING C#. Code on design page is fine working But when i'm write code on .cs file then it is not working. please help me how to fix this.

推荐答案





CodeFile是其中一个原因对于这个问题。



另一个可能性是类名。 Asp.net有Partial类概念,因此.designer.cs文件和.cs文件必须具有相同的类名。





问候,

Chetan Patel
Hi,

The CodeFile is one of the reason for this issue.

Another one possiblity is the Class name. Asp.net has Partial class concept, so both .designer.cs file and .cs file must have same class name.


Regards,
Chetan Patel


检查设计页面中的这一行顶部,特别是 Inherits =您的页面名称



<![CDATA [<%@ Page Language =C#AutoEventWireup =trueCodeBehind =Default.aspx.csInherits =默认%>





如果您正在 特定文件夹中创建页面,例如内部演示文件夹默认页面然后在设计页面中检查 此代码





<![CDATA [<%] @ Page Language =C#AutoEventWireup =trueCodeBehind =Default.aspx.csInherits =Demo.Default%>



AND in。 cs页





名称空间ProjectName.Demo

{

公共部分类默认值:system.web.ui

{

}





}
check this line in design page At top and specially Inherits=" Your page Name "

<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>


and if You Are make page in particular folder like inside Demo Folder Default page then check this code in design page


<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Demo.Default" %>

AND in .cs page


namespace ProjectName.Demo
{
public partial class Default:system.web.ui
{
}


}


>



检查上面的标签在你的代码中,CodeFile =Default.aspx.cs是针对你的.cs文件(你想写你的代码),我不知道这是否有用(只是猜测)但是一次在设计代码页中查看此标记。
>

check the above tag is in your code or not and CodeFile="Default.aspx.cs" is targetting on your .cs file(in which u want to write ur code),i don't know this is useful or not(just guessing) but once check out this tag in your design code page.


这篇关于..net文件中的代码不能在asp.net中接受。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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