Disabling ASP.NET CSS Friendly Adapters

CSS compatible adapters for ASP.NET are great for creating markup that is easy to erase. The great advantage of the GridView adapter is that it generates the THEAD, TBODY, and TFOOT tags that allow you to do really interesting things with libraries like jQuery - for example, Tablesorter for client-side sorting.

The problem is that it seems to be global on / off for adapters via the CSSFriendlyAdapters.browser file. What should I do if I already have many GridViews that are currently being produced and just want to use friendly CSS adapters for the new?

So, I would be interested in two types of solutions:

1) A way to expand or modify the GridView (a new tag is acceptable) to display the THEAD and TBODY tags.

2) A way to conditionally apply or disable custom CSS adapters.

+3
source share
3 answers

I did something like this after a little research

you need to subclass the control you want to use (gridview in your case, radioobuttonlist in my case)

public class UlRadioButtonList : RadioButtonList
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Call the base RenderContents method.
            base.Render(writer);
        }
    }

Then just use the .browser file for your custom subclass instead of the asp.net control

eg.

<browsers>
  <browser refID="Default">
    <controlAdapters>
      <adapter controlType="FM.Web.Source.WebControls.UlRadioButtonList" adapterType="FM.Web.Source.ControlAdapters.RadioButtonListAdapter" />
    </controlAdapters>
  </browser>
</browsers>
+4
source

CSS Friendly ...

Disabling Adapters

AdapterEnabled = "false" , ASP.NET . : . , . AdapterEnabled .

, GridView RenderChildren. , , , . , GridView, - . , , - /, / .

0

THEAD TBODY:

: GridView jQuery TableSorter

Bare Bones:

myGrid.UseAccessibleHeader = true;
myGrid.HeaderRow.TableSection = TableRowSection.TableHeader;
myGrid.FooterRow.TableSection = TableRowSection.TableFooter;
0

Source: https://habr.com/ru/post/1699316/


All Articles