locked
Button color should get changed automatically from green to red RRS feed

  • Question

  • User97511230 posted

    Hello everyone.
    I am preparing a simple application in .net 3.5 (Visual Studio 2008, C#).
    We have a business of Real estate. So total of 80 plots. So I have added 80 buttons in the design page, and gave green color to all buttons (indicating that green color plots are available for sale). So now, when I click on any of the green colored plot to sell it, it redirects me to new page, where I need to enter the plot details, customer details, mode of payment etc. But I am stuck here. When I enter all the details of the customer, plot details, mode of payment etc and select Plot is "SOLD", the button color should automatically get changed to RED. Red color will indicate that the particular plot has been sold. So how can I do this?
    Please help me. Will be very grateful.
    Thanks in advance.

    Wednesday, April 11, 2012 1:16 AM

All replies

  • User436389104 posted

    You can define a public property in your Form(page) wich can set  the color:

    public Color Button1Color
    {
        set
        {
            Button1.ForeColor = value;
        }
    }

    Now you can set the button from another form(after sale).

    Wednesday, April 11, 2012 1:35 AM
  • User79986525 posted

    Hi ,

    Button.ForeColor = System.Drawing.Color.Red;

    Wednesday, April 11, 2012 9:40 AM
  • User97511230 posted

    No dear. When I enter all the customer details, plot details, mode of payment etc and then when I select "Plot is SOLD", the button color should change from Green to Red automatically. 

    So is there is any way such that, when I select "SOLD", the button color automatically should change to RED color.

    Wednesday, April 11, 2012 9:43 AM
  • User97511230 posted

    No dear. When I enter all the customer details, plot details, mode of payment etc and then when I select "Plot is SOLD", the button color should change from Green to Red automatically. 

    So is there is any way such that, when I select "SOLD", the button color automatically should change to RED color.

    Wednesday, April 11, 2012 9:43 AM
  • User1929035129 posted

    create a table in database having details of all plots inluding sold or not

    in page load iterate through all plots and set color according to this column(SoldOrNot)

    like red for yes and green for no

    when you sold the plot change value of SoldOrNot in table to yes

    when you will come to mainpage color will be automatically changed

    Wednesday, April 11, 2012 9:47 AM
  • User226677443 posted

    where you want to show "80 buttons design page" ?

    Tuesday, April 17, 2012 7:37 AM