How can you use a ListBox control to display items with Price above a specific value in one color and the ones below that value in a different color

The ListBox Web server control prevents us from assigning the style property to each item in the ListBox. This bug is confirmed by Microsoft Knowledge Base Article – 309338 So, instead use a HTML ListBox with runat=server <SELECT id=’listbox1′ size=’14’ runat=’server’ > </SELECT> VB.NET Dim myconnection As SqlConnection Dim myda As SqlDataAdapter Dim ds As DataSet Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myconnection = New SqlConnection(‘Server=localhost;uid=sa;password=;database=northwind;’) myda = New SqlDataAdapter(‘Select * from Products ‘, myconnection) ds = New DataSet() myda.Fill(ds, ‘AllTables’) dim i as Integer For i = 0 To ds.Tables(0).Rows.Count – 1 listBox1.Items.Add(New ListItem(ds.Tables(0).Rows(i)(‘UnitPrice’), ds.Tables(0).Rows(i)(‘ProductID’))) If ds.Tables(0).Rows(i)(‘UnitPrice’) <= 25 Then listBox1.Items(i).Attributes.Add(‘style’, ‘color:red’) Else listBox1.Items(i).Attributes.Add(‘style’, ‘color:green’) End If Next End Sub C# SqlConnection mycn; SqlDataAdapter myda; DataSet ds; String strConn; private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { strConn=’Data Source=localhost;uid=sa;pwd=;Initial Catalog=northwind’; mycn = new SqlConnection(strConn); myda = new SqlDataAdapter (‘Select * FROM Products ‘, mycn); ds = new DataSet(); myda.Fill (ds,’Table’); for(int i = 0 ;i < ds.Tables[0].Rows.Count – 1;i++) { listBox1.Items.Add (new ListItem(ds.Tables[0].Rows[i][‘UnitPrice’].ToString(), ds.Tables[0].Rows[i][‘ProductID’].ToString())); if(Convert.ToDouble(ds.Tables[0].Rows[i][‘UnitPrice’].ToString()) <= 25 ) { listBox1.Items[i].Attributes.Add(‘style’, ‘color:red’); } else { listBox1.Items[i].Attributes.Add(‘style’, ‘color:green’); } } } }

After installing SP4 none of my ASP.NET pages developed using Framework 1.0 are showing the errors related to security

To resolve this issue, identify the user account that is used to run the program, and then assign the ‘Impersonate a client after authentication’ user right to that user account. To do this, follow these steps: Click Start, point to Programs, point to Administrative Tools, and then click Local Security Policy. Expand Local Policies, and then click User Rights Assignment. In the right pane, double-click Impersonate a client after authentication. In the Local Security Policy Setting dialog box, click Add. In the Select Users or Group dialog box, click the user account that you want to add, click Add, and then click OK. Click OK. For more details refer Overview of the ‘Impersonate a Client After Authentication’….

Why do I get error message ‘Failed to Start Monitoring Directory Changes’ when i try to browse ASP.NET page

The ASPNET worker process doesn’t have ‘Read & Execute’, ‘ List Folder Contents’, ‘ Read permissions’ permissions to detect file changes in Web.Config, Machine.config, Bin files, or Cache dependency files. Or one of the directory names in the hierarchy of that file path is greater than eight characters long. For more information refer PRB: ‘Failed to Start Monitoring Directory Changes’ Error Message When You Browse to ASP.NET Page FIX: ‘Failed to start monitoring directory changes’ error message when you browse to an ASP.NET page