简体   繁体   English

id元素的链接标记在asp.net网页中不起作用

[英]link tag with id element doesnt work in asp.net webpage

The following line of code doesnt work in asp.net website, how do i get the webpage to work? 以下代码行在asp.net网站上不起作用,如何使该网页正常工作?

<link rel="stylesheet" href="css/style.css" id="main-styles-link">

It doesnt like id the part "id="main-styles-link"". 它不喜欢id部分“ id =“ main-styles-link”“。

Because on the designer file it shows 因为在设计器文件中它显示

    protected global::System.Web.UI.HtmlControls.HtmlLink main-styles-link;

and this is highlighted as error.. 并突出显示为错误。

Severity Code Description Project File Line Suppression State Error CS1003 Syntax error, ',' expected WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error CS1002 ; 严重性代码说明项目文件行抑制状态错误CS1003语法错误“,”预期WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误CS1002; expected WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error CS1519 Invalid token '-' in class, struct, or interface member declaration WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error CS1519 Invalid token '-' in class, struct, or interface member declaration WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error CS1519 Invalid token ';' 预期的WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误CS1519类,结构或接口成员声明中的无效令牌'-'WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误CS1519类,结构或接口成员声明中的无效令牌'-'WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误CS1519无效的令牌';' in class, struct, or interface member declaration WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error CS1519 Invalid token ';' 类,结构或接口成员声明中的WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误CS1519无效的令牌';' in class, struct, or interface member declaration WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error IDE1007 The name 'styles' does not exist in the current context. 类,结构或接口成员声明中的WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误IDE1007名称“样式”在当前上下文中不存在。 WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active Error IDE1007 The name 'link' does not exist in the current context. WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22活动错误IDE1007名称“链接”在当前上下文中不存在。 WebApplication12 C:\\Users\\Dipesh.Patel\\source\\repos\\WebApplication12\\WebApplication12\\WebForm1.aspx.designer.cs 22 Active WebApplication12 C:\\ Users \\ Dipesh.Patel \\ source \\ repos \\ WebApplication12 \\ WebApplication12 \\ WebForm1.aspx.designer.cs 22有效

Use 采用

id="mainStylesLink"

instead of: 代替:

id="main-styles-link"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM