Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid (body only) contained in <span>...</span> tags

Reply
Thread Tools

DataGrid (body only) contained in <span>...</span> tags

 
 
Dan Bishop
Guest
Posts: n/a
 
      06-07-2004
Hi,

I have a DataGrid control that displays many records. As such, I have
been given a requirement to contain only the body of my DataGrid
control within <span> tags (this enables us to use a scroll bar to
look through the records in the datagrid, instead of using paging).

My problem is this: How can I get the header for the DataGrid to be
displayed outside the <span>? I do not know if this is possible with
the ASP.NET built-in DataGrid control, but I would be most interested
in learning possible solutions... the current code that I am using is
posted below. It shows the DataGrid entirely wrapped in the <span>,
meaning that the Header is not visible once you scroll down a little
bit...

CODE:
<span runat="server" id="dgSpan">
<aspataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
AllowPaging="False" ShowHeader="True"
ShowFooter="False"Runat="server">
<Columns>
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
Visible="False"></asp:ButtonColumn>
<asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
<ItemTemplate>
<asp:Label ID="lblIssueID" Width="25px" Text='<%#
DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
CssClass="regularText">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="Status" DataField="status"
SortExpression="status" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center"
ItemStyle-Width="45px"></asp:BoundColumn>
<asp:BoundColumn HeaderText="Priority" DataField="priority"
SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center"
ItemStyle-Width="45px"></asp:BoundColumn>
<asp:BoundColumn HeaderText="Task" DataField="taskDesc"
SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
<asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="Gray" ForeColor="White"
Font-Bold="True"></HeaderStyle>
</aspataGrid>
</span>

Many Thanks,
-Dan Bishop
 
Reply With Quote
 
 
 
 
Kilic Beg
Guest
Posts: n/a
 
      06-07-2004
you can create another datagrid before the <span> tag and display only the
header there...
you should clear (delete all rows) from your dataset before you bind to the
header DataGrid...

or also...
you create a <DIV> tag before the <span> tag and move the header there with
javascript...
below is the code....
=================================
<script language="javascript>
var dg = document.getElementById("dgIssueListing");
var dgTbl = dg.getElementsByTagName("table");
dgTbl= dgTbl[0];

var rowcopy = dgTbl.rows[0].cloneNode(true);
DivHeaderTbl.rows[0].appendChild(rowcopy);

dgTbl.rows[0].removeNode();
DivHeaderTbl.moveRow(1,0);
</script>
=====================================

---------
Kilic Beg


"Dan Bishop" <> wrote in message
news: om...
> Hi,
>
> I have a DataGrid control that displays many records. As such, I have
> been given a requirement to contain only the body of my DataGrid
> control within <span> tags (this enables us to use a scroll bar to
> look through the records in the datagrid, instead of using paging).
>
> My problem is this: How can I get the header for the DataGrid to be
> displayed outside the <span>? I do not know if this is possible with
> the ASP.NET built-in DataGrid control, but I would be most interested
> in learning possible solutions... the current code that I am using is
> posted below. It shows the DataGrid entirely wrapped in the <span>,
> meaning that the Header is not visible once you scroll down a little
> bit...
>
> CODE:
> <span runat="server" id="dgSpan">
> <aspataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
> CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
> AllowPaging="False" ShowHeader="True"
> ShowFooter="False"Runat="server">
> <Columns>
> <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
> Visible="False"></asp:ButtonColumn>
> <asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
> <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
> <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
> <ItemTemplate>
> <asp:Label ID="lblIssueID" Width="25px" Text='<%#
> DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
> CssClass="regularText">
> </asp:Label>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:BoundColumn HeaderText="Status" DataField="status"
> SortExpression="status" HeaderStyle-HorizontalAlign="Center"
> ItemStyle-HorizontalAlign="Center"
> ItemStyle-Width="45px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Priority" DataField="priority"
> SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
> ItemStyle-HorizontalAlign="Center"
> ItemStyle-Width="45px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Task" DataField="taskDesc"
> SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
> SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
> </Columns>
> <HeaderStyle BackColor="Gray" ForeColor="White"
> Font-Bold="True"></HeaderStyle>
> </aspataGrid>
> </span>
>
> Many Thanks,
> -Dan Bishop



 
Reply With Quote
 
 
 
 
Kilic Beg
Guest
Posts: n/a
 
      06-07-2004
also check this article out..
http://www.dnzone.com/ShowDetail.asp?NewsId=564

"Dan Bishop" <> wrote in message
news: om...
> Hi,
>
> I have a DataGrid control that displays many records. As such, I have
> been given a requirement to contain only the body of my DataGrid
> control within <span> tags (this enables us to use a scroll bar to
> look through the records in the datagrid, instead of using paging).
>
> My problem is this: How can I get the header for the DataGrid to be
> displayed outside the <span>? I do not know if this is possible with
> the ASP.NET built-in DataGrid control, but I would be most interested
> in learning possible solutions... the current code that I am using is
> posted below. It shows the DataGrid entirely wrapped in the <span>,
> meaning that the Header is not visible once you scroll down a little
> bit...
>
> CODE:
> <span runat="server" id="dgSpan">
> <aspataGrid ID="dgIssueListing" GridLines="Both" BorderWidth="2px"
> CssClass="regularText" AutoGenerateColumns="False" AllowSorting="True"
> AllowPaging="False" ShowHeader="True"
> ShowFooter="False"Runat="server">
> <Columns>
> <asp:ButtonColumn ButtonType="LinkButton" CommandName="Select"
> Visible="False"></asp:ButtonColumn>
> <asp:TemplateColumn HeaderText="ID" SortExpression="issueID">
> <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
> <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle>
> <ItemTemplate>
> <asp:Label ID="lblIssueID" Width="25px" Text='<%#
> DataBinder.Eval(Container.DataItem, "issueID")%>' Runat="server"
> CssClass="regularText">
> </asp:Label>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:BoundColumn HeaderText="Status" DataField="status"
> SortExpression="status" HeaderStyle-HorizontalAlign="Center"
> ItemStyle-HorizontalAlign="Center"
> ItemStyle-Width="45px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Priority" DataField="priority"
> SortExpression="priority" HeaderStyle-HorizontalAlign="Center"
> ItemStyle-HorizontalAlign="Center"
> ItemStyle-Width="45px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Task" DataField="taskDesc"
> SortExpression="taskDesc" ItemStyle-Width="120px"></asp:BoundColumn>
> <asp:BoundColumn HeaderText="Subject" DataField="issueSubj"
> SortExpression="issueSubj" ItemStyle-Width="275px"></asp:BoundColumn>
> </Columns>
> <HeaderStyle BackColor="Gray" ForeColor="White"
> Font-Bold="True"></HeaderStyle>
> </aspataGrid>
> </span>
>
> Many Thanks,
> -Dan Bishop



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer Rob Nicholson ASP .Net 3 05-28-2005 03:11 PM
Evaluating struts tags inside my own custom tags... A. Brinkmann Java 2 04-16-2004 07:44 AM
JSP newbie - use include, custom tags, standard tags - or what? Mike Java 3 01-09-2004 09:30 AM
RegEx to find CFML tags nested in HTML tags Dean H. Saxe Perl 0 01-03-2004 06:11 PM
Custom Tags within Custom Tags. Ranganath Java 2 10-21-2003 06:14 AM



Advertisments