Beginner Mistake

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jesse

    #1

    Beginner Mistake

    I am trying to display a string located in my code behind page. I have
    tried accessing the variable directly, and also as a Property. Every
    time I recieve the following error:

    CS0201: Only assignment, call, increment, decrement, and new object
    expressions can be used as a statement

    This is the html:

    <td style="WIDTH: 703px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 28px"
    width="703" background= "<%FirstTD; %>" >

    And this is the code:

    public string FirstTD
    {
    get
    {
    if(Request.Quer yString["style"]=="children")
    firstTD = "images/bg_kathy_templa te_r2_c2.gif";
    else
    firstTD = string.Empty;
    return firstTD;
    }
    }


    Any ideas. I know this is basic, but I would really appreciate any input.

  • Jesse

    #2
    Re: Beginner Mistake

    I answered my own question, thanks anyway

    Jesse wrote:
    [color=blue]
    > I am trying to display a string located in my code behind page. I have
    > tried accessing the variable directly, and also as a Property. Every
    > time I recieve the following error:
    >
    > CS0201: Only assignment, call, increment, decrement, and new object
    > expressions can be used as a statement
    >
    > This is the html:
    >
    > <td style="WIDTH: 703px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 28px"
    > width="703" background= "<%FirstTD; %>" >
    >
    > And this is the code:
    >
    > public string FirstTD
    > {
    > get
    > {
    > if(Request.Quer yString["style"]=="children")
    > firstTD = "images/bg_kathy_templa te_r2_c2.gif";
    > else
    > firstTD = string.Empty;
    > return firstTD;
    > }
    > }
    >
    >
    > Any ideas. I know this is basic, but I would really appreciate any input.
    >[/color]

    Comment

    Working...