asp.net fixed title column and field-specific implementation _ practical skills

Source: Internet
Author: User

APSX page code: JS

Copy Code code as follows:

<script src= ". /js/jquery-1.8.3.min.js "type=" Text/javascript "></script>-
<script src= ". /js/jquery-ui-1.10.3.custom.js "type=" Text/javascript "></script>

<script src= ". /js/gridviewscroll.min.js "type=" Text/javascript "></script>

<link href= ". /css/gridviewscroll.css "rel=" stylesheet "type=" Text/css "/>"

All the above documents can be downloaded directly from the Internet.

<script type= "Text/javascript" >

$ (document). Ready (function () {
Gridviewscroll ();
});

function Gridviewscroll () {

Because my GridView has to be in a div. So to get the corresponding height and width, the general direct digital setting is good

var gridwidth = $ ("#divservic"). width ();
var gridheight = $ ("#divservic"). Height ();

var headerheight = $ ("#divHeader"). Height ();

Gridheight = Gridheight-headerheight;

$ (' #<%=gridview2.clientid%> '). Gridviewscroll ({
width:gridwidth,//width must not be 100% can be directly written dead
height:gridheight,//height can be written directly to death
freezesize:4//control the first few columns do not move
});
}


Copy Code code as follows:

<div id= "Divservic" style= "WIDTH:100%;MARGIN-BOTTOM:2PX; height:220px; " >

<asp:gridview id= "GridView2" runat= "Server" cellpadding= "4" forecolor= "#333333" width= "100%"
Bordercolor= "#D1DDAA" allowpaging= "True" datakeynames= "Installationid"
Onpageindexchanging= "Gridview2_pageindexchanging"
Onrowdatabound= "Gridview2_rowdatabound"
onrowdeleting= "gridview2_rowdeleting" autogeneratecolumns= "False"
allowsorting= "True" onsorting= "gridview2_sorting" >
<rowstyle cssclass= "Gridviewscrollitem"/>>------------------------------------------------------------ -Here's the style to add
<footerstyle backcolor= "#1C5E55" font-bold= "True" forecolor= "white"/>
<pagerstyle cssclass= "Gridviewscrollpager"/>------------------------------------------------------------- Here's the style to add
<selectedrowstyle backcolor= "#C5BBAF"/>
<editrowstyle backcolor= "#7C6F57"/>
<alternatingrowstyle backcolor= "White" bordercolor= "#D1DDAA"/>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:checkbox id= "Ckbitem" runat= "Server"/>
</ItemTemplate>

</asp:TemplateField>
<asp:boundfield datafield= "Installationid" headertext= "Installationid"
sortexpression= "Installationid"/>
<asp:boundfield datafield= "Completed" headertext= "Completed"/>
<asp:boundfield datafield= "Tid" headertext= "Tid"/>
<asp:boundfield datafield= "Mid" headertext= "mid"/>
<asp:boundfield datafield= "bank" headertext= "bank"/>
<asp:boundfield datafield= "model" headertext= "model"/>
<asp:boundfield datafield= "Barcode" headertext= "Barcode"/>
<asp:boundfield datafield= "Datereq" headertext= "Datereq"
sortexpression= "Datereq"/>

</Columns>
</asp:GridView>
</div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.