2

In javascript I can easily use JQuery to get css, for example:

$("#id").css();

I need to do the same in c#. Im getting the html source into string (usually parsing it with agility pack), and I need to get the css values of a specific htmlnode.

does a way doing so exist?

thanks.

1
  • possibly NO... you can only get the values in the attrubutes in the html element, but possibly you can't get the css values from a css class from server side Commented Mar 18, 2012 at 2:26

1 Answer 1

2

Maybe this is what you are looking for-->HTML Element Class and HTML Element GetAttributes.

Although, I do suggest to use jquery as much as possible for this. HTML is more for UI, and C# code is usually more for business logic, so if you can avoid mixing this as much as possible, that is better :)

Sign up to request clarification or add additional context in comments.

3 Comments

Wow, genuinely surprised that even this exists.
yes Im trying to get whatever I can through jquery but this one I need to get using c#. anyway your suggestion looks promising, I'll look into it and update if it did the trick. thanks for your reply.
seems ok, but working with the controller is really annoying.. thanks for the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.