CompilationError

  • Thread starter Thread starter CreativeMind
  • Start date Start date
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
 
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)
 
Back
Top