?
Solved

datalist fxied header

Posted on 2011-04-22
6
Medium Priority
?
1,218 Views
Last Modified: 2012-05-11
I want to make a fixed header for my datalist.
I am trying to use this
http://www.codeproject.com/KB/webforms/DataGridFixedHeader.aspx
but doesn't seem to work.
Any help appreciated
0
Comment
Question by:Angela4eva
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 35449954
You gave us nothing by which to help you.  Code please...  A URL is even better.
0
 

Author Comment

by:Angela4eva
ID: 35449977
<ItemTemplate>
                                 <tr >

                                <td ><b>
                                        <asp:Label ID="mdesc" runat="server" Text='<%# Eval("Comp").ToString() + ". " + Eval("ComtDesc").ToString() + " " %>' ></asp:Label>                                        
                                        <asp:HiddenField ID="hdesc" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.CompGUID") %>' />

                                    </b></td>
                                 </tr>
                                 <tr ><td>
                                        <asp:Literal ID="mylistList" runat="server"></asp:Literal>
                                        <asp:HiddenField ID="HiddenField1" runat="server" />
                                    </td>
                                </tr>
                            </ItemTemplate>



I want to keep below part always fixed. just this row.
 <tr >

                                <td ><b>
                                        <asp:Label ID="mdesc" runat="server" Text='<%# Eval("Comp").ToString() + ". " + Eval("ComtDesc").ToString() + " " %>' ></asp:Label>                                        
                                        <asp:HiddenField ID="hdesc" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.CompGUID") %>' />

                                    </b></td>
                                 </tr>
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 35450278
So the example you referenced gives an example of a fixed "header".  You seem to want to have a fixed "row", whcih is a little weird since it seems to appear in the middle of your data as opposed to the top (header).  Would you mind describing your data and your desired solution?  Thanks.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:Angela4eva
ID: 35450616
I want to fix the fisrt row
0
 
LVL 14

Accepted Solution

by:
Designbyonyx earned 2000 total points
ID: 35450822
ah, cool.  So you ideally want to use markup like this, which is both semantic (meaningful) and helps achieve your goal.

<table>
  <thead>
    <tr>
      <th>This is a header for column 1</th>
      <th>This is a header for column 2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>This is data in data row 1 column 1</td>
      <td>This is data in data row 1 column 2</td>
    </tr>
    <tr>
      <td>This is data in data row 2 column 1</td>
      <td>This is data in data row 2 column 2</td>
    </tr>
  </tbody>
</table>

Then, you will need to do some CSS magic.  This can best be explained if you view source on this page:

http://www.imaputz.com/cssStuff/bigFourVersion.html

One major drawback of this is the fact that your columns have to have fixed widths.  If your table has fewer than 4 columns, then it might be easier to use DIVs.  Hope that helps.
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 35485215
Just noting that that solution does not work too well with IE.  Looks like you might need to use javascript to get the desired results.  Check out this jQuery plugin:

http://fixedheadertable.com
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question