Template Field

Displaying information from grid...

Page 1 of 1

2 Replies - 5132 Views - Last Post: 03 March 2009 - 11:31 AM Rate Topic: -----

#1 shill  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 36
  • Joined: 19-September 08

Template Field

Posted 03 March 2009 - 11:16 AM

I am trying to get information from the grid to show in the template fields. I think I have to have boundfields in there somehow, but whenever I try to put one in it gives me all sorts of build errors, so I think I'm going about this wrong....Can someone point me in the right direction?

<asp:GridView ID="grdFeedbackItem2" runat="server" AllowPaging = "True" AllowSorting="True" AutoGenerateColumns="False" Height="216px" Width="392px" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
		<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
		<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
		<Columns>
			<asp:TemplateField>
			<ItemTemplate>
					<table style="border-right: navy thin solid; border-top: navy thin solid; border-left: navy thin solid; width: 720px; border-bottom: navy thin solid; text-align: left;">
			<tr>
				<td style="width: 381px; height: 21px; background-color: #333366;">
					<asp:Label ID="lblusername" runat="server" Font-Bold="True" ForeColor="AliceBlue" Text="Posted By: "></asp:Label>
					<asp:Label ID="lblCommentID" runat="server" ForeColor="White" Text=""></asp:Label>
					<asp:Label ID="lblItemID" runat="server" ForeColor="White" Text=""></asp:Label></td>
				<td colspan="3" style="height: 21px; background-color: #333366; text-align: right;">
					<asp:Label ID="lblStarttime" runat="server" Text="Posted on: " ForeColor="AliceBlue"></asp:Label></td>
			</tr>
			<tr>
				<td colspan="4" style="background-color: gray; height: 21px; text-align: left;">
					<asp:Label ID="lblTitle" runat="server" Font-Bold="True" ForeColor="White" Text=""></asp:Label></td>
			</tr>
			<tr>
				<td colspan="4" style="background-color: silver; text-align: left;">
					<asp:Label ID="lblFeedback" runat="server" Text=""></asp:Label></td>
			</tr>
			<tr>
				<td colspan="4" style="height: 21px; text-align: left">
				</td>
			</tr>
			<br />
		</table>
			</ItemTemplate>
			</asp:TemplateField>
		</Columns>
		<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
		<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
		<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
		<AlternatingRowStyle BackColor="#DCDCDC" />
	</asp:GridView>


Is This A Good Question/Topic? 0
  • +

Replies To: Template Field

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Template Field

Posted 03 March 2009 - 11:24 AM

What run-time errors are you getting first of all?
Was This Post Helpful? 0
  • +
  • -

#3 shill  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 36
  • Joined: 19-September 08

Re: Template Field

Posted 03 March 2009 - 11:31 AM

Nevermind, figured it out!

<asp:GridView ID="grdFeedbackItem2" runat="server" AllowPaging = "True" AllowSorting="True" AutoGenerateColumns="False" Height="216px" Width="392px" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
		<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
		<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
		<Columns>
			<asp:TemplateField>
			<ItemTemplate>
					<table style="border-right: navy thin solid; border-top: navy thin solid; border-left: navy thin solid; width: 720px; border-bottom: navy thin solid; text-align: left;">
			<tr>
				<td style="width: 381px; height: 21px; background-color: #333366;">
					<asp:Label ID="lblusername" runat="server" Font-Bold="True" ForeColor="AliceBlue" Text="Posted By: "></asp:Label>
					<asp:Label ID="lblEmployeeID" runat="server" ForeColor="White" Text='<%# Eval ( "employeeid" ) %>'></asp:Label>
					<asp:Label ID="lblCommentID" runat="server" ForeColor="White" Text='<%# Eval ( "commentid" ) %>' Visible="False"></asp:Label>
					<asp:Label ID="lblItemID" runat="server" ForeColor="White" Text='<%# Eval ( "itemid" ) %>' Visible="False"></asp:Label>&nbsp;</td>
				<td colspan="3" style="height: 21px; background-color: #333366; text-align: right; width: 327px;">
					<asp:Label ID="lblStarttime" runat="server" Text="Posted on: " ForeColor="AliceBlue"></asp:Label>
					<asp:Label ID="Label1" runat="server" ForeColor="White" Text='<%# Eval ( "starttime" ) %>'></asp:Label>
					&nbsp;</td>
			</tr>
			<tr>
				<td colspan="4" style="background-color: gray; height: 21px; text-align: left;">
					<asp:Label ID="lblTitle" runat="server" Font-Bold="True" ForeColor="White" Text='<%# Eval ( "title" ) %>'></asp:Label></td>
			</tr>
			<tr>
				<td colspan="4" style="background-color: silver; text-align: left;">
					<asp:Label ID="lblFeedback"  Text='<%# Eval ( "comments" ) %>'  runat="server" ></asp:Label></td>
			</tr>
			<tr>
				<td colspan="4" style="height: 21px; text-align: left">
				</td>
			</tr>
		</table>
			</ItemTemplate>
			</asp:TemplateField>
		</Columns>
		<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
		<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
		<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
		<AlternatingRowStyle BackColor="Gainsboro" />
	</asp:GridView>


Thanks for the reply Psychocoder. :) Guess I just needed to post something before I'd have the lightbulb turn on!

This post has been edited by shill: 03 March 2009 - 11:33 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1