奇怪的ascx编译错误 [英] Strange ascx compilation error

查看:73
本文介绍了奇怪的ascx编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的是,在这里有一个带有以下行的ascx:


< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#Gallery.Filename

%>" />


一切正常,我的Gallery对象有一个Filename属性。

我刚刚添加了Gallery.Directory,并改变了上述内容对此:


< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#Gallery.Directory

%> /<%#Gallery.Filename%>" />


现在得到错误


CS1040:预处理程序指令必须显示为第一个非空格
$ b一行中的$ b字符


我尝试将它们更改为.Filename,以防我忘记完全

添加目录属性,但是还是一样。我尝试添加/ Thumbs /

而不仅仅是/两者之间,因为它在另一个控件中工作

(不是ASP:图像)看起来像这样:


< img src ="照片/<%#Photo.Gallery.Directory%> / Thumbs /<%#Photo.Filename%>"

alt ="<%#Photo.Title%> " />


以前有人碰过这个吗?

-

雏菊奶牛

Strange one here, got an ascx with the following line in it:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Filename
%>" />

All works fine, and my Gallery object has a Filename property.
I''ve just added Gallery.Directory, and changed the above line to this:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Directory
%>/<%# Gallery.Filename %>" />

And now get the error

CS1040: Preprocessor directives must appear as the first non-whitespace
character on a line

I tried changing them both to .Filename, in case I''d forgotten to completely
add the Directory property, but still the same. I tried adding "/Thumbs/"
instead of just a "/" between the two, since it works in another control
(not an ASP:Image) that looks like this:

<img src="Photos/<%# Photo.Gallery.Directory%>/Thumbs/<%# Photo.Filename %>"
alt="<%# Photo.Title %>" />

Anyone ever come across this before?
--
Daisy The Cow

推荐答案

试试这个:

< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#Gallery.Directory

+" /" + Gallery.Filename%>" />


你可能在aspx-to-C#转换器中遇到某种错误,其中

它没有生成正确的C#源代码。


-

--Grant

此帖子按原样提供。没有保证,也没有赋予任何权利。

Daisy <哒*** @ nospam.oops>在消息中写道

news:7b *************** @ newsfep4-winn.server.ntli.net ...
try this:
<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Directory
+ "/" + Gallery.Filename %>" />

You''re probably hitting some sort of bug in the aspx-to-C# converter, where
it''s not generating correct C# source code.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Daisy" <da***@nospam.oops> wrote in message
news:7b***************@newsfep4-winn.server.ntli.net...
奇怪的是,在这里有一个带有以下行的ascx:

< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#Gallery.Filename
%>" />

一切正常,我的Gallery对象有一个Filename属性。
我刚刚添加了Gallery.Directory,并将上面的行改为:

< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#
Gallery.Directory%> /<%#Gallery.Filename%>" />

现在得到错误

CS1040:预处理器指令必须作为第一个非空白字符出现在
完全添加Directory属性,但仍然相同。我尝试添加/ Thumbs /
而不仅仅是/。两者之间,因为它在另一个控件(不是ASP:图像)中工作,看起来像这样:

< img src ="照片/<%#Photo.Gallery .Directory%> / Thumbs /<%#Photo.Filename
%>" alt ="<%#Photo.Title%>" />

以前有人遇到过这个问题吗?
-
雏菊奶牛
Strange one here, got an ascx with the following line in it:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Filename
%>" />

All works fine, and my Gallery object has a Filename property.
I''ve just added Gallery.Directory, and changed the above line to this:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Directory %>/<%# Gallery.Filename %>" />

And now get the error

CS1040: Preprocessor directives must appear as the first non-whitespace
character on a line

I tried changing them both to .Filename, in case I''d forgotten to completely add the Directory property, but still the same. I tried adding "/Thumbs/"
instead of just a "/" between the two, since it works in another control
(not an ASP:Image) that looks like this:

<img src="Photos/<%# Photo.Gallery.Directory%>/Thumbs/<%# Photo.Filename %>" alt="<%# Photo.Title %>" />

Anyone ever come across this before?
--
Daisy The Cow


你能看一下ASP.NET csharp编译器生成的源代码吗?

或者发送它以便我们可以看到代码有什么问题?

" Grant Richins [MS]" < GR ***** @ online.microsoft.com>在消息中写道

新闻:#1 ************* @ TK2MSFTNGP12.phx.gbl ...
Can you look at the source code that the ASP.NET csharp compiler generates?
Or send it so that we can see what is wrong with the code?

"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message
news:#1*************@TK2MSFTNGP12.phx.gbl...
试试这个:
< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#
Gallery.Directory +" /" + Gallery.Filename%>" />

你可能在aspx-to-C#转换器中遇到某种错误,
它没有生成正确的C#源代码。

-
--Grant
此帖子按原样提供。没有保证,并且不授予
权利。

雏菊 <哒*** @ nospam.oops>在消息中写道
新闻:7b *************** @ newsfep4-winn.server.ntli.net ...
try this:
<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Directory + "/" + Gallery.Filename %>" />

You''re probably hitting some sort of bug in the aspx-to-C# converter, where it''s not generating correct C# source code.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.

"Daisy" <da***@nospam.oops> wrote in message
news:7b***************@newsfep4-winn.server.ntli.net...
这里有一个奇怪的,得到一个带有以下行的ascx:

< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#
Gallery.Filename%>" />

一切正常,我的Gallery对象有一个Filename属性。
我刚刚添加了Gallery.Directory,并将上面的行改为:

< asp:Image id =" galleryPhoto" RUNAT = QUOT;服务器" ImageUrl ="<%#
Strange one here, got an ascx with the following line in it:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%# Gallery.Filename %>" />

All works fine, and my Gallery object has a Filename property.
I''ve just added Gallery.Directory, and changed the above line to this:

<asp:Image id="galleryPhoto" runat="server" ImageUrl="<%#


Gallery.Directory


Gallery.Directory

%> /<%#Gallery.Filename%>" />

现在得到错误

CS1040:预处理器指令必须作为第一个非空白字符出现在
%>/<%# Gallery.Filename %>" />

And now get the error

CS1040: Preprocessor directives must appear as the first non-whitespace
character on a line

I tried changing them both to .Filename, in case I''d forgotten to


完全

添加Directory属性,但仍然相同。我尝试添加
" / Thumbs /"而不仅仅是/两者之间,因为它在另一个控件(不是ASP:图像)中工作,看起来像这样:

< img src ="照片/<%#Photo.Gallery .Directory%> / Thumbs /<%#Photo.Filename
add the Directory property, but still the same. I tried adding "/Thumbs/" instead of just a "/" between the two, since it works in another control
(not an ASP:Image) that looks like this:

<img src="Photos/<%# Photo.Gallery.Directory%>/Thumbs/<%# Photo.Filename


%>"


%>"

alt ="<%#Photo.Title%> " />

以前有人遇到过这个问题吗?
-
雏菊奶牛
alt="<%# Photo.Title %>" />

Anyone ever come across this before?
--
Daisy The Cow



" Sankar Nemani" < SN ***** @ nospamlumedx.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
"Sankar Nemani" <sn*****@nospamlumedx.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
你能来吗?看一下ASP.NET csharp编译器
生成的源代码?或者发送它以便我们可以看到代码有什么问题?
Can you look at the source code that the ASP.NET csharp compiler generates? Or send it so that we can see what is wrong with the code?




如果你解释怎么做,也许......我没有戳过周围的东西

我还没写:D

-

Daisy The Cow



If you explain how to do it, maybe... I''ve not been poking around in things
I didn''t write yet :D
--
Daisy The Cow


这篇关于奇怪的ascx编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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