Fixed Column in Grid View

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kavithadv
    New Member
    • Nov 2007
    • 1

    Fixed Column in Grid View

    hi
    Please help me i want to fix a column in grid view i used style for locking the
    column since i am setting the position as relative its not working properly
    i have given my code below could any body fix this issue

    [CODE=css]<style type="text/css">
    /* Div container to wrap the datagrid */
    div#div-datagrid
    {
    width: 700px;
    overflow-x: auto;
    overflow-y: hidden;
    overflow: -moz-scrollbars-vertical;
    scrollbar-base-color:#ffeaff;
    }

    /* Locks the left column */
    td.locked, th.locked {
    position:relati ve;
    cursor: default;
    /*IE5+ only*/

    left: expression(docu ment.getElement ById("div-datagrid").scro llLeft-2);
    }

    /* DataGrid Item and AlternatingItem Style*/
    .GridRow {font-size: 10pt; color: black; font-family: Arial;
    background-color:#ffffff; height:35px;}
    .GridAltRow {font-size: 10pt; color: black; font-family: Arial;
    background-color:#eeeeee; height:35px;}</PRE>

    </style>

    <html>
    <div id="div-datagrid" >
    <asp:GridView ID="GridView1" PagerSettings-Visible="false" runat="server" CellPadding="4" ForeColor="#333 333"
    AllowSorting="T rue" AutoGenerateCol umns="False" PageSize="7" AllowPaging="tr ue"
    DataKeyNames="C lientId" OnRowDataBound= "GridView1_RowD ataBound" >
    <AlternatingRow Style CssClass= "GridAltRow "/>
    <RowStyle CssClass= "GridRow"/>
    <Columns>
    <asp:BoundFie ld DataField="Clie ntId" HeaderText="Cli entId" InsertVisible=" False"
    ReadOnly="True" SortExpression= "ClientId" />
    <asp:BoundFie ld DataField="Ente rpriseUserName" />
    <column>
    </DataGrid>
    </Html>[/CODE]
    and in code behind i called the rowbound event

    protected void GridView1_RowDa taBound(object sender, GridViewRowEven tArgs e)
    {
    e.Row.Cells[0].CssClass = "locked";
    }



    Is there is any other solution Please
    Last edited by Shashi Sadasivan; Nov 27 '07, 06:04 AM. Reason: adding code tags
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    You have to explain below queries
    What is your front end?
    What version is that?
    What is the error you are getting?
    Peoples are not here to simply fix your problem, you have to try.

    Comment

    • YGayatri
      New Member
      • Nov 2007
      • 9

      #3
      Try using "Frozen" property Or "Read only" property can be set to true for that column.

      Comment

      • CyberSoftHari
        Recognized Expert Contributor
        • Sep 2007
        • 488

        #4
        I think she never mean read-only column!
        Read-only column! = Fixed column.

        Comment

        • Shashi Sadasivan
          Recognized Expert Top Contributor
          • Aug 2007
          • 1435

          #5
          Hi,
          Welcome to TSDN

          Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

          This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

          Comment

          Working...