CompilationError

C

CreativeMind

hi,
can anyone guide me plz.
i m adding attribute of runat=server from codebehind file
<asp:imagebutton id="imgCompletionDate" CssClass="clImageButton"
ImageAlign="absMiddle" BorderStyle="None" ImageUrl="..images
\img1000024.gif" CausesValidation="False" Height="20"></
asp:imagebutton></TD>
in code behindfile method
imgCompletionDate.Attributes.Add("runat","'server'");

, but it gives error CS1040: Preprocessor directives must appear as
the first non-whitespace character on a line and shows
the line which binds data at runtime. that is
<TD align="left" valign="top" class="GridCell" height="25px">
<%#DataBinder.Eval(Container, "DataItem.DocumentTitle")%>
</TD>
thx
 
B

bruce barker

run can not add the runat=server from the codebehind. it makes no sense. the
point of the attribute is to parse the html into a standalone control, and
add to the controls collection. to apply the attribute server side imples
that it has already happened.

also you databind expression is invalid because it can only be applied to
server control properties.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top