Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert hidden column in asp:GridView but still available client side

This is simple. All I want to do is insert a hidden column into an asp:Griview that I'll be able to access through javascript. Any pointers?

like image 840
m.edmondson Avatar asked Dec 06 '22 01:12

m.edmondson


2 Answers

You can hide a column by setting its CssClass property, e.g:

<style>
.hidden {display:none;}
</style>

...

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="Id" ItemStyle-CssClass="hidden"
            HeaderStyle-CssClass="hidden" />
        <asp:BoundField DataField="Title" />
    </Columns>
</asp:GridView>
like image 195
M4N Avatar answered Dec 09 '22 14:12

M4N


Item attribute

ItemStyle-CssClass="hidden"

css class

.hidden{ display: none; }
like image 34
Tim B James Avatar answered Dec 09 '22 16:12

Tim B James