Click here to Skip to main content
15,906,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a 12 Labels
In asp.net page having texts Of all the Months

I have to retrieve the Data from Sql
which returns three or more month Values

The requirement is that
according to the DataBase Values
the Labels in the page must get Bold..

For ex : If Datbase values return months name Jan ,Feb and Oct
then Accordingly the label having text Jan,Feb,Oct must
get bold..or highlighted... and other labels remain as usual.

here is what i tried
Dim sd as New SqlDataAdapter("Select Months from table",con)
Dim dt as new Datatable
sd.Fill(dt)
For i as Integer =0 to dt.rows.count -1
    If  dt.rows(i).Item("Months") = 'Jan'
           -------Applied css to label1
    End If
    -------similary added the If Condition and applied the css

Next

.
Posted
Updated 22-Jul-12 18:25pm
v4

And what is the issue?

It all sounds like server side implementation. No separate event required, all can be handled when you access the database. Once the data is returned, based on the data just set the style of needed label as bold. Simple would be to just change the CssClass for the label.

Try out!
 
Share this answer
 
Comments
Karwa_Vivek 21-Jul-12 9:23am    
Yes I am Using Css accordingly.
But Confused to fetch the Data and to check that with the label names.
I know have to use loop for checking. But I am not getting any clue how to check
Sandeep Mewara 21-Jul-12 12:21pm    
You have defined 12 labels. Based on data fetched, in switch case just set the css as per need.
Karwa_Vivek 21-Jul-12 9:24am    
Have Fetched the Data using dataAdapater.
But How I will Check that in loop thats the Issue
Hi
This is pretty simple
rather than creating lables create them dynamically and change the text accordingly and display it on the page

And If you have any style requirements use CSS to achieve it.
 
Share this answer
 
v2
Comments
Karwa_Vivek 21-Jul-12 13:23pm    
can you please explain this a bit..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900