ASP.NET - how to retrieve CSS styles applied by javascript on page postback?

Tags: javascript,,css

Problem :

I'm working on a page in an ASP.NET site where certain fields (table rows) are being hidden/displayed by some javascript/jquery code, based on selections made on the page by the user.

When the save button is clicked, in the server side code I want to only save the values of the controls in the rows that are visible, however following post back any style applied to the row (i.e. "display:none;") by the javascript code is not available. I've tried doing the following to determine whether a row is visible:

If Not trRef.Attributes.CssStyle.Value.Contains("display:none;")
    'row is visible
End If

But the CssStyle property is empty (as I gather the controls have been recreated from the viewstate). I thought I might be able to use Request.Form(control.UniqueID) (as per this post) but it seems this will only retrieve the value of a control, and nothing else?

How can I determine whether these rows are visible on post back?

Solution :

Styles are not posted to the server, just form values.

You'll need to generate a different mechanism. For instance a hidden field containing visible rows (or hidden ones) indexes separated by comman and you'd process this hidden field on the server.

    CSS Howto..

    How to change first word color through css [duplicate]

    How to move the scrollbar down

    How to set css to a specific selector using jQuery

    How to fix height respective screen resolution?

    Anyone know how to create CSS rectangle with one corner chopped off?

    How to display a border-bottom only if table cells are not empty (CSS)

    How to create a texture paper background using CSS without image

    How can I best port a frame-based “HTML of yesteryear” application to modern CSS(3)? [closed]

    How to fix clickable background with Wordpress theme and CSS

    how to remove the border-right for a last child in css

    how to keep the aspect ratio of an image in bounding box - CSS

    How can I split code-blocks into a list?

    How to import a CSS file from an external bundle resource

    How to change header and footer to full width

    How can I make responsive JQuery left margin?

    how to apply div on hover my table td

    how to make changes permanently to css elements with -moz-transform?

    How to add missing browser-specific css declaration properties and prefixes to epub [closed]

    TYPO3: how to add an element to the RTE, which allows the user to use a defined CSS class

    how to display only 100 rows of 1000 from a database with options to go to next 100 and previous 100 in html/php/css/js [closed]

    How to manage length of dashes

    navbar is split into multiple div classes - how to stick them all to the top on scroll? (javescript)

    How To create slider/toggle to change font size on screen with HTML CSS JS [closed]

    how to bring two blocks closer

    How can I add CSS to grandchild pages in an unordered list on Wordpress?

    How to keep the link color on CSS buttons as one color when changing default link colors?

    how to apply css to a specific element of a table?

    How to achieve pages like a math notebook in css?

    How do you get the width of an element without a defined width?

    How to create a floating div with jQuery