running32
asked on
Add space to datagrid
I really need some help on this.
I have a datagrid that displays the records from a query.
I would like to add a space each time the date changes in the datagrid. The query should display 3 dates with a space in between each date.
Thank you
CODE ************************** ********** ********** ********
<%@ Import Namespace="System.Data.Ole Db" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace=" System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>Health District Quick Add Hours</title>
<link href="styles.css" rel="stylesheet">
<script runat="server" language="VB">
dim objCmd as New SqlCommand
Dim objRdr as SqlDataReader
Dim objConn as New SqlConnection("Server=xxxx xx;uid=xx; pwd=xxxx;D atabase=xx xxxxx;")
Dim strCmd As String
Sub Page_Load()
If Not IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
dim getusername as string
Dim MyName As String = Request.ServerVariables("L OGON_USER" )
response.write(MyName)
objConn.Open()
Dim currentdate As DateTime = Now.AddDays(-4)
Dim strCurrentdate As String = currentdate.ToString("yyyy .MM.dd") 'ANSI format the date
objCmd.CommandText = "select eh.recordid, firstname + ' ' + lastname as name, timein, timeout, description from employeehours as eh inner join employeelist as el on eh.employeeid = el.employeeid inner join masterjobcodelist as mjc on eh.jobcode = mjc.jobcode where firstname = 'Justine' and lastname = 'Cleary' and timein > CONVERT(datetime, '" & strCurrentdate & "', 102) order by timein "
objCmd.Connection = objConn
objRdr = objCmd.ExecuteReader()
dgAddressBook.DataSource = objRdr
dgAddressBook.DataBind()
objRdr.Close()
objConn.Close()
End Sub
</script>
</HEAD>
<body>
<form runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding="0" background="Images/header_ bg.gif">
<tr>
<td><img src="Images/header_top1.gi f" width="450" height="142"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="157"></td>
<td></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td valign="top" width="160">
<!-- HyperLink Controls for navigation -->
<img src="Images/book_closed.gi f" width="16" height="16" alt="+"><asp:HyperLink NavigateUrl="index.aspx" runat="server" Text="Home" ID="Hyperlink1" /><br>
<img src="Images/book_closed.gi f" width="16" height="16" alt="+"><asp:HyperLink NavigateUrl="quickaddhours .aspx" runat="server" Text="Edit/Add Hours" ID="Hyperlink2"></asp:Hype rLink><br>
<img src="Images/book_closed.gi f" width="16" height="16" alt="+"><asp:HyperLink NavigateUrl="weeklyhours.a spx" runat="server" Text="Review Hours" ID="Hyperlink4" /><br>
<!-- End HyperLink Controls -->
</td>
<td valign="top">
<h1>Quick Edit Hours</h1>
<p><asp:DataGrid id="dgAddressBook" runat="server" AutoGenerateColumns="false " CellPadding="4" GridLines="None"
DataKeyField="recordID">
<ItemStyle Font-Name="Arial" Font-Size="10pt" ForeColor="#000000" />
<HeaderStyle Font-Name="Arial" Font-Size="10pt" Font-Bold="true" BackColor="#003366" ForeColor="#FFFFFF" />
<AlternatingItemStyle Font-Name="Arial" Font-Size="10pt" BackColor="#CCCCCC" />
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="reco rdid" DataNavigateUrlFormatStrin g="javascr ipt:var test = window.open('popup.aspx?re cordid={0} ', null, 'width=400,height=300');"
DataTextField="recordid" HeaderText="Edit Hours"></asp:HyperLinkColu mn>
<asp:BoundColumn DataField="timein" HeaderText="Time In" ReadOnly="true" />
<asp:BoundColumn DataField="timeout" HeaderText="Time out" ReadOnly="true" />
<asp:BoundColumn DataField="description" HeaderText="Description" ReadOnly="true" />
</Columns>
</asp:DataGrid></p>
</td>
</tr>
</table>
</form>
</body>
</HTML>
I have a datagrid that displays the records from a query.
I would like to add a space each time the date changes in the datagrid. The query should display 3 dates with a space in between each date.
Thank you
CODE **************************
<%@ Import Namespace="System.Data.Ole
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace=" System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>Health District Quick Add Hours</title>
<link href="styles.css" rel="stylesheet">
<script runat="server" language="VB">
dim objCmd as New SqlCommand
Dim objRdr as SqlDataReader
Dim objConn as New SqlConnection("Server=xxxx
Dim strCmd As String
Sub Page_Load()
If Not IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
dim getusername as string
Dim MyName As String = Request.ServerVariables("L
response.write(MyName)
objConn.Open()
Dim currentdate As DateTime = Now.AddDays(-4)
Dim strCurrentdate As String = currentdate.ToString("yyyy
objCmd.CommandText = "select eh.recordid, firstname + ' ' + lastname as name, timein, timeout, description from employeehours as eh inner join employeelist as el on eh.employeeid = el.employeeid inner join masterjobcodelist as mjc on eh.jobcode = mjc.jobcode where firstname = 'Justine' and lastname = 'Cleary' and timein > CONVERT(datetime, '" & strCurrentdate & "', 102) order by timein "
objCmd.Connection = objConn
objRdr = objCmd.ExecuteReader()
dgAddressBook.DataSource = objRdr
dgAddressBook.DataBind()
objRdr.Close()
objConn.Close()
End Sub
</script>
</HEAD>
<body>
<form runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding="0" background="Images/header_
<tr>
<td><img src="Images/header_top1.gi
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="157"></td>
<td></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td valign="top" width="160">
<!-- HyperLink Controls for navigation -->
<img src="Images/book_closed.gi
<img src="Images/book_closed.gi
<img src="Images/book_closed.gi
<!-- End HyperLink Controls -->
</td>
<td valign="top">
<h1>Quick Edit Hours</h1>
<p><asp:DataGrid id="dgAddressBook" runat="server" AutoGenerateColumns="false
DataKeyField="recordID">
<ItemStyle Font-Name="Arial" Font-Size="10pt" ForeColor="#000000" />
<HeaderStyle Font-Name="Arial" Font-Size="10pt" Font-Bold="true" BackColor="#003366" ForeColor="#FFFFFF" />
<AlternatingItemStyle Font-Name="Arial" Font-Size="10pt" BackColor="#CCCCCC" />
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="reco
DataTextField="recordid" HeaderText="Edit Hours"></asp:HyperLinkColu
<asp:BoundColumn DataField="timein" HeaderText="Time In" ReadOnly="true" />
<asp:BoundColumn DataField="timeout" HeaderText="Time out" ReadOnly="true" />
<asp:BoundColumn DataField="description" HeaderText="Description" ReadOnly="true" />
</Columns>
</asp:DataGrid></p>
</td>
</tr>
</table>
</form>
</body>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.