1 Replies - 5424 Views - Last Post: 24 July 2012 - 04:49 AM Rate Topic: -----

#1 Uttara45223  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-July 12

i had done the asp.net program related to color class

Posted 24 July 2012 - 02:08 AM

<%@ Page Language="C#" %>
<%@Import Namespace="System.Drawing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script  runat= "server">

    protected void B1_Click(object sender, EventArgs e)
    {
        if (Text1.Text == "jas" && Text2.Text == "dish")
        {
            Lbl.Text = "valid user";
           //Lbl.ForeColor = " Color.blue";
        }
        else
        {
            Lbl.Text = "invali user";
          // Lbl.ForeColor = "Color.red";
        }
            
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }


</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body id="L1">
    <form id="form1" runat="server">
    <div style="color: #008000">
    
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    
        login
        <br />
        <hr  style="border-color: #FF0000; font-size: large; font-style: italic;" />
    
    </div>
    <table style="width:60%;">
        <tr>
            <td>
                user id</td>
            <td>
               
                <asp:TextBox ID="Text1" runat="server"></asp:TextBox>
               
            </td>
        </tr>
        <tr>
            <td>
                password</td>
            <td>
               
                <asp:TextBox ID="Text2" runat="server" TextMode="Password"></asp:TextBox>
               
            </td>
        </tr>
    </table>
    <hr />
    <asp:Button ID="B1" runat="server" BackColor="#669900" ForeColor="#3366FF" 
        onclick="B1_Click" Text="login" />
    <hr />
    <asp:Label ID="Lbl" runat="server"  Height="5px" Text="lbl" 
        Width="5px"></asp:Label>
    <br />
    </form>
</body>
</html>




i got an error for the lines in comment sections and error is " CS0029: Cannot implicitly convert type 'string' to 'System.Drawing.Color'
"
i dont understand whats the reason...........

Is This A Good Question/Topic? 0
  • +

Replies To: i had done the asp.net program related to color class

#2 MrShoes  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 312
  • View blog
  • Posts: 488
  • Joined: 13-June 12

Re: i had done the asp.net program related to color class

Posted 24 July 2012 - 04:49 AM

It's exactly like your error message says: you're trying to pass a string to a System.Color - remove the "" quotation marks around the colour definitions.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1