PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 1.00 average.

CS1040: Preprocessor directives must appear as the first non-white

 
 
=?Utf-8?B?V0I=?=
Guest
Posts: n/a
 
      16th May 2005
Hi,

I have a check box in a column of my DataGrid. This DataGrid lists all the
users of my site and the CheckBox basically is for me to toggle between
disabling or enabling a user.

This is the code for the CheckBox.

<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox id="ChkBoxDisable" runat="server" Checked='<%#
DataBinder.Eval(Container.DataItem, "disable") %>' AutoPostBack="True"
OnCheckedChanged='DisableClicked(<%# DataBinder.Eval(Container.DataItem,
"userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>)' />
</ItemTemplate>
</asp:TemplateColumn>

I wanted it to call the method DisableClicked(int userID, int currentStatus)
when it's clicked. However, it's giving me a compiler error:

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

What's wrong?

Thanks.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmF2aWNoYW5kcmFuIEouVi4=?=
Guest
Posts: n/a
 
      16th May 2005
Instead of

'DisableClicked(<%# DataBinder.Eval(Container.DataItem,
> "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>)'


DisableClicked('<%# DataBinder.Eval(Container.DataItem,
> "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>')


It must have been the single-quote that must be throwing the exception.

with regards,

J.V.

"WB" wrote:

> Hi,
>
> I have a check box in a column of my DataGrid. This DataGrid lists all the
> users of my site and the CheckBox basically is for me to toggle between
> disabling or enabling a user.
>
> This is the code for the CheckBox.
>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:CheckBox id="ChkBoxDisable" runat="server" Checked='<%#
> DataBinder.Eval(Container.DataItem, "disable") %>' AutoPostBack="True"
> OnCheckedChanged='DisableClicked(<%# DataBinder.Eval(Container.DataItem,
> "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>)' />
> </ItemTemplate>
> </asp:TemplateColumn>
>
> I wanted it to call the method DisableClicked(int userID, int currentStatus)
> when it's clicked. However, it's giving me a compiler error:
>
> CS1040: Preprocessor directives must appear as the first non-whitespace
> character on a line
>
> What's wrong?
>
> Thanks.
>

 
Reply With Quote
 
=?Utf-8?B?V0I=?=
Guest
Posts: n/a
 
      17th May 2005
Hi J.V.,

Now it gives "The server tag is not well formed." on the line:

<asp:CheckBox id="ChkBoxDisable" runat="server"
Checked='<%# DataBinder.Eval(Container.DataItem, "disable") %>'
AutoPostBack="True"
OnCheckedChanged=DisableClicked('<%# DataBinder.Eval(Container.DataItem,
"userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>') />


WB.


"Ravichandran J.V." wrote:

> Instead of
>
> 'DisableClicked(<%# DataBinder.Eval(Container.DataItem,
> > "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>)'

>
> DisableClicked('<%# DataBinder.Eval(Container.DataItem,
> > "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>')

>
> It must have been the single-quote that must be throwing the exception.
>
> with regards,
>
> J.V.
>
> "WB" wrote:
>
> > Hi,
> >
> > I have a check box in a column of my DataGrid. This DataGrid lists all the
> > users of my site and the CheckBox basically is for me to toggle between
> > disabling or enabling a user.
> >
> > This is the code for the CheckBox.
> >
> > <asp:TemplateColumn>
> > <ItemTemplate>
> > <asp:CheckBox id="ChkBoxDisable" runat="server" Checked='<%#
> > DataBinder.Eval(Container.DataItem, "disable") %>' AutoPostBack="True"
> > OnCheckedChanged='DisableClicked(<%# DataBinder.Eval(Container.DataItem,
> > "userID") + "," + DataBinder.Eval(Container.DataItem, "disable") %>)' />
> > </ItemTemplate>
> > </asp:TemplateColumn>
> >
> > I wanted it to call the method DisableClicked(int userID, int currentStatus)
> > when it's clicked. However, it's giving me a compiler error:
> >
> > CS1040: Preprocessor directives must appear as the first non-whitespace
> > character on a line
> >
> > What's wrong?
> >
> > Thanks.
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preprocessor directives must appear as the first non-whitespace character on a line towsie Webmaster / Programming 0 2nd Jun 2009 04:25 PM
VB.Net missing preprocessor directives? PJ6 Microsoft VB .NET 2 6th Mar 2009 02:25 PM
control references with preprocessor directives Bob Microsoft C# .NET 6 10th Oct 2008 02:47 PM
setting references with preprocessor directives Bob Microsoft C# .NET 1 5th Oct 2008 07:26 AM
Preprocessor directives in codebehind file Theon Greyjoy Microsoft ASP .NET 1 6th Oct 2006 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:46 AM.