Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从页面调用方法_C#_Asp.net - Fatal编程技术网

C# 从页面调用方法

C# 从页面调用方法,c#,asp.net,C#,Asp.net,我必须根据用户在第一页选择的内容来区分一些页面元素(图像、css等等) 我这样使用: <img id="imgBackground" src='<%= this.GetLinkBasedOnUser("img/background1.jpg") %>' /> ”/> 方法GetLinkBasedOnUser执行简单的字符串连接。 我喜欢这种方式,因为我试图将“用户界面”与代码分开 但是 <link href="<%= this.GetLinkBasedOn

我必须根据用户在第一页选择的内容来区分一些页面元素(图像、css等等)

我这样使用

<img id="imgBackground" src='<%= this.GetLinkBasedOnUser("img/background1.jpg") %>' />
”/>
方法GetLinkBasedOnUser执行简单的字符串连接。 我喜欢这种方式,因为我试图将“用户界面”与代码分开

但是

<link href="<%= this.GetLinkBasedOnUser('css/cssStyle1.css') %>" rel="stylesheet" type="text/css" /> 

试试这个:

<link href='<%= this.GetLinkBasedOnUser("css/cssStyle1.css") %>' rel="stylesheet" type="text/css" />


c#中的字符串要求使用
作为字符串分隔符,而不是
(char)

我们可以在codebehind中看到您对
GetLinkBasedOnUser
的声明吗?错误是什么?您是否尝试在
GetLinkBasedOnUser
中放置断点?您可以显示codebehind方法的签名吗?为什么不在单击时触发事件?