stevenmobiles
New Member
I have a listbox on my page where i am checking the driver status if driver status is 1 then i change the font color in red Status 2 then i change color of font in listbox in green . Like that i want that i place a image with item in listbox if status will be 1 then i display a red image with that . How can i do that for you i am placing my aspx and c# code below\[code\]<asp:ListBox ID="ddlDriver" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="ddlDriver_SelectedIndexChanged" runat="server" BackColor="White" Height="380px"></asp:ListBox>\[/code\]C# Code for listbox item font color \[code\] protected void ColorFillDrvier(){ for (int i = 0; i < ddlDriver.Items.Count; i++) { int drvierNo = Convert.ToInt32(ddlDriver.Items.Value); Drivers _driv = DataRepository.DriversProvider.GetByDriverNumber(drvierNo); if (_driv.DriverStatus == 1) { ddlDriver.Items.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "red"); } else if (_driv.DriverStatus == 2) { ddlDriver.Items.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "green"); } else if (_driv.DriverStatus == 3) { ddlDriver.Items.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "yellow"); } else if (_driv.DriverStatus == 4) { ddlDriver.Items.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "blue"); } else if (_driv.DriverStatus == 5) { ddlDriver.Items.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "black"); } }}\[/code\]How can i do that . Thanks in advance for you all