Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Just Like if i write
HtmlNode.Id then i am getting Id Of element div. So if i have to get class name of the div element
what i have to write ...

need assistence

thank you..
Posted

1 solution

C#
// Where node is a HtmlNode instance
string[] cssClasses = node.Attributes["class"] != null
                                      ? node.Attributes["class"].Value.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries)
                                      : new string[0];

foreach(string cssClass in cssClasses)
{
    // Do whatever you need to do with the CSS class
}
 
Share this answer
 
Comments
Anjanee Kumar Singh 8-Aug-13 1:59am    
many many thank for ur support.....
Member 12103395 8-Feb-16 15:09pm    
Great answer! Thank you for your help.

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