How to make controls scrollable (GridView, DropDownList, CheckBoxList etc)

Envelope your control inside of a div that has it’s vertical (overflow-y) set to scroll and horizontal (overflow-x) set to hidden. This will create a vertically container for your control. Useful in cases when you have long sets of data that you want to scroll through them (example GridView).

<style type="text/css">
    .ScrollDiv
    {
        border-color: Gray;
        border-style: solid;
        border-width: 1px;
        height: 200px;
        width: 210px;
        overflow-y: scroll;
        overflow-x: hidden;
    }    
</style>
        <div class="ScrollDiv">
            <asp:CheckBoxList ID="CheckBoxList1" runat="server">
                <asp:ListItem>Test1</asp:ListItem>
                <asp:ListItem>Test2</asp:ListItem>
                <asp:ListItem>Test3</asp:ListItem>
                <asp:ListItem>Test4</asp:ListItem>
                <asp:ListItem>Test5</asp:ListItem>
                <asp:ListItem>Test6</asp:ListItem>
                <asp:ListItem>Test7</asp:ListItem>
                <asp:ListItem>Test8</asp:ListItem>
                <asp:ListItem>Test9</asp:ListItem>
                <asp:ListItem>Test10</asp:ListItem>
                <asp:ListItem>Test11</asp:ListItem>
                <asp:ListItem>Test12</asp:ListItem>
                <asp:ListItem>Test13</asp:ListItem>
                <asp:ListItem>Test14</asp:ListItem>
            </asp:CheckBoxList>
        </div>

How To Render Column Data In GridView But Hide It From The User

There may be a time where you want to hide a GridView Column from a user but still need to access the data bound to the particular column.

Use CSS and apply it to the BoundField’s ItemStyle:

<style type="text/css">
    .hiddencol
    {
        display:none;
    }

</style>
    <asp:GridView ID="gvWorkActivitySelections" runat="server" AutoGenerateColumns="False"
        EnableModelValidation="True" OnRowCommand="ChoicesUpdate" 
        ShowHeader="False">
        <Columns>
            <asp:ButtonField ButtonType="Button" Text="Remove" CommandName="remove" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" >           
            <ItemStyle CssClass="hiddencol" />
            </asp:BoundField>
            
            
        </Columns>
    </asp:GridView>

More Info

Adding Items From One GridView To Another GridView Using GridView Buttons Including Sorting Lists

AddRemoveButtonGrids.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddRemoveButtonGrids.ascx.cs"
    Inherits="com.dereksandbox.ui.Controls.AddRemoveButtonGrids" %>
<!-- Left Grid (All Choices) -->
<asp:GridView ID="GridViewChoices" runat="server" AutoGenerateColumns="False" EnableModelValidation="True"
    OnRowCommand="ChoicesUpdate">
    <Columns>
        <asp:ButtonField ButtonType="Button" Text="Add" CommandName="add" />
        <asp:BoundField DataField="Text" HeaderText="Text" SortExpression="Text" />
        <asp:BoundField DataField="Value" HeaderText="Value" SortExpression="Value" />
    </Columns>
</asp:GridView>
<!-- Right Grid (Selected Items) -->
<asp:GridView ID="GridViewSelections" runat="server" AutoGenerateColumns="False"
    EnableModelValidation="True" OnRowCommand="ChoicesUpdate">
    <Columns>
        <asp:ButtonField ButtonType="Button" Text="Remove" CommandName="remove" />
        <asp:BoundField DataField="Text" HeaderText="Text" SortExpression="Text" />
        <asp:BoundField DataField="Value" HeaderText="Value" SortExpression="Value" />
    </Columns>
</asp:GridView>

AddRemoveButtonGrids.ascx.cs (Code Behind)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.dereksandbox.bl.Entities;
using com.dereksandbox.bl.ServiceManagers;



namespace com.dereksandbox.ui.Controls
{
    public partial class AddRemoveButtonGrids : System.Web.UI.UserControl
    {

        private List<TVEntity> ItemSelections
        {
            get
            {
                if (ViewState["ItemSelections"] == null)
                {
                    ViewState["ItemSelections"] = new List<TVEntity>();
                }

                return (List<TVEntity>)ViewState["ItemSelections"];
            }

            set
            {
                ViewState["ItemSelections"] = value;
            }

        }

        private List<TVEntity> AvailableChoices
        {
            get
            {
                if (ViewState["AvailableChoices"] == null)
                {
                    ViewState["AvailableChoices"] = new List<TVEntity>();
                }

                return (List<TVEntity>)ViewState["AvailableChoices"];
            }

            set
            {
                ViewState["AvailableChoices"] = value;
            }

        }


        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                // on first load get initial available choices               

                // Fill ViewState property: AvailableChoices 
                AvailableChoices = ListManager.getTVs();
                // Sort the AvailableChoices List by Text property
                AvailableChoices.Sort((x, y) => (x.Text.CompareTo(y.Text)));

            }

            // Bind the selections in viewstate to the Selections GridView         

            GridViewSelections.DataSource = ItemSelections;
            GridViewSelections.DataBind();

            GridViewChoices.DataSource = AvailableChoices;
            GridViewChoices.DataBind();

        }

        protected void ChoicesUpdate(object sender, GridViewCommandEventArgs e)
        {
            // get the row index stored in the CommandArgument property
            int index = Convert.ToInt32(e.CommandArgument);

            // get the GridViewRow where the command is raised
            GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];

            // for bound fields, values are stored in the Text property of Cells [ fieldIndex ] 
            string text = selectedRow.Cells[0].Text;
            string value = selectedRow.Cells[1].Text;


            if (e.CommandName == "add")
            {

                // Add new item to Object bound to selection GridView
                TVEntity TVitem = new TVEntity();
                TVitem.Text = text;
                TVitem.Value = value;
                ItemSelections.Add(TVitem);

                // Remove item from Available Choices.
                // Since the GridView index is the same as the 
                // collection index, remove by GridView selected index               
                AvailableChoices.RemoveAt(index);

            }
            else if (e.CommandName == "remove")
            {
                // Remove item from Item Selections
                // Since the GridView index is the same as the 
                // collection index, remove by GridView selected index
                ItemSelections.RemoveAt(index);


                // As we are removing from the Selections add back to available choices
                TVEntity TVitem = new TVEntity();
                TVitem.Text = text;
                TVitem.Value = value;
                AvailableChoices.Add(TVitem);

            }
            // Bind Choices and Selection GridViews to display new additions/subtractions

            // Sort AvailableChoices and ItemSelections List by Text property
            AvailableChoices.Sort((x, y) => (x.Text.CompareTo(y.Text)));
            ItemSelections.Sort((x, y) => (x.Text.CompareTo(y.Text)));

            // After we apply the sorting we must re-set the DataSource
            GridViewSelections.DataSource = ItemSelections;
            GridViewChoices.DataSource = AvailableChoices;

            GridViewSelections.DataBind();
            GridViewChoices.DataBind();


        }

    }
}

Service Manager (ListManager.cs)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.dereksandbox.bl.Entities;

namespace com.dereksandbox.bl.ServiceManagers
{
    public class ListManager
    {
        public static List<TVEntity> getTVs()
        {
            // object to return
            List<TVEntity> TVs = new List<TVEntity>();

            // create some dummy data
            TVs.Add(new TVEntity() { Text = "Samsung", Value = "1" });
            TVs.Add(new TVEntity() { Text = "LG", Value = "2" });
            TVs.Add(new TVEntity() { Text = "Song", Value = "3" });
            TVs.Add(new TVEntity() { Text = "Apex", Value = "4" });
            TVs.Add(new TVEntity() { Text = "Olevia", Value = "5" });
            TVs.Add(new TVEntity() { Text = "Mitshibi", Value = "6" });
            TVs.Add(new TVEntity() { Text = "Sharp", Value = "7" });
        
            return TVs;


        }
    }
}


TVEntity.cs (Entity)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.dereksandbox.bl.Entities
{
    [Serializable]
    public class TVEntity
    {
        public string Text { get; set; }
        public string Value { get; set; }
    }
}

More good info here