Storing And Displaying Images On ASP.NET Web Forms Website - c#

The website I am building holds 571 houses with information about each house. Each house has a image associated with it. The information is coming from a SQL database table called houses. I am using a custom pager to filter the 571 houses with 5 results per page. I am using a repeater control to do this so I don't have multiple aspx pages. My question is I want to store the folder with the 571 images in a location (stored on a network drive) and set a path to the specific image in that folder for each house in the database table column called image and display the images for each house while using the repeater control. I have looked at a lot of tutorials but nothing is helping me. Please don't post any links to tutorials because I have looked at them all. If you have done anything like this before please post your experience because this is new to me. Source code below.
Database Structure
[Id] NCHAR (10) NOT NULL,
[Name] NVARCHAR (MAX) NULL,
[Townland] NVARCHAR (MAX) NULL,
[Near] NVARCHAR (MAX) NULL,
[Status] NVARCHAR (MAX) NULL,
[Built] NVARCHAR (MAX) NULL,
[Description] NVARCHAR (MAX) NULL,
[Families] NVARCHAR (MAX) NULL,
[Image] VARCHAR (200) NULL,
CONSTRAINT [PK_Houses] PRIMARY KEY CLUSTERED ([Id] ASC)
Example Table Data
Houses.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#expanderHead").click(function () {
$("#expanderContent").slideToggle();
if ($("#expanderSign").text() == "+") {
$("#expanderSign").html("-")
}
else {
$("#expanderSign").text("+")
}
});
});
</script>
<script>
$(function () { setCurrentTab('tab2'); });
</script>
<div class="box">
<div>
<div class="body">
<h1>Search Houses</h1>
<p>
Welcome to Houses of Mayo search page. Enter details below to search for a specific house. Additionally you can use advanced search or search by map.
</p>
<div>
<form style="margin-left: 32%">
Name of House:
<input type="search" placeholder="Search" style="margin-left: 7%">
</form>
<br />
<form style="margin-left: 32%">
Townland:
<input type="search" placeholder="Search" style="margin-left: 14%">
</form>
<br />
<form style="margin-left: 32%">
Near:
<input type="search" placeholder="Search" style="margin-left: 20%">
</form>
<br />
<form style="margin-left: 32%"><a id="expanderHead" style="cursor: pointer;">Advanced Search</a><input type="button" value="Search" class="button" style="margin-left: 35%" /></form>
<div id="expanderContent" style="display: none">
<br />
<form style="margin-left: 32%">
Associated Families:
<input type="search" placeholder="Search" style="margin-left: 2%">
</form>
<br />
<form style="margin-left: 32%">
Keyword:
<input type="search" placeholder="Search" style="margin-left: 15%">
</form>
<br />
</div>
</div>
<br />
<br />
<br />
<h1>Houses By Alphabetical Order</h1>
<ul id="rooms">
<asp:Repeater ID="rptData" runat="server">
<ItemTemplate>
<li>
<a href='<%# "HouseInfo.aspx?HouseId=" + Eval("Id").ToString() %>'>
<img src="" alt="img" width="398" height="287"/></a>
<h2>
<a href='<%# "HouseInfo.aspx?HouseId=" + Eval("Id").ToString() %>'>
<asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label></a></h2>
<p>
<b>ID: </b>
<asp:Label runat="server" Text='<%# Eval("Id") %>'></asp:Label>
<br />
<b>Name of House: </b>
<asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label>
<br />
<b>Townland: </b>
<asp:Label runat="server" Text='<%# Eval("Townland") %>'></asp:Label>
<br />
<b>Near: </b>
<asp:Label runat="server" Text='<%# Eval("Near") %>'></asp:Label>
<br />
<b>Status/Public Access: </b>
<asp:Label runat="server" Text='<%# Eval("Status") %>'></asp:Label>
<br />
<b>Date Built: </b>
<asp:Label runat="server" Text='<%# Eval("Built") %>'></asp:Label>
</p>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
<asp:Repeater ID="rptPager" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkPage" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
Style="padding: 8px; margin: 2px; background: #ac9e94; border: solid 1px #666; font: 8pt; color: #594334; display: inline-block;"
CssClass='<%# Convert.ToBoolean(Eval("Enabled")) ? "page_enabled" : "page_disabled" %>'
OnClick="Page_Changed" OnClientClick='<%# !Convert.ToBoolean(Eval("Enabled")) ? "return false;" : "" %>'></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</asp:Content>
Houses.aspx.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace Houses_of_Mayo.images
{
public partial class Houses : System.Web.UI.Page
{
private int PageSize = 5;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GetHousesPageWise(1);
}
}
private void GetHousesPageWise(int pageIndex)
{
string constring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("GetHousesPageWise", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#PageIndex", pageIndex);
cmd.Parameters.AddWithValue("#PageSize", PageSize);
cmd.Parameters.Add("#RecordCount", SqlDbType.Int, 4);
cmd.Parameters["#RecordCount"].Direction = ParameterDirection.Output;
con.Open();
IDataReader idr = cmd.ExecuteReader();
rptData.DataSource = idr;
rptData.DataBind();
idr.Close();
con.Close();
int recordCount = Convert.ToInt32(cmd.Parameters["#RecordCount"].Value);
this.PopulatePager(recordCount, pageIndex);
}
}
}
private void PopulatePager(int recordCount, int currentPage)
{
double dblPageCount = (double)((decimal)recordCount / Convert.ToDecimal(PageSize));
int pageCount = (int)Math.Ceiling(dblPageCount);
List<ListItem> pages = new List<ListItem>();
if (pageCount > 0)
{
for (int i = 1; i <= pageCount; i++)
{
pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
}
}
rptPager.DataSource = pages;
rptPager.DataBind();
}
protected void Page_Changed(object sender, EventArgs e)
{
int pageIndex = int.Parse((sender as LinkButton).CommandArgument);
this.GetHousesPageWise(pageIndex);
}
public override void VerifyRenderingInServerForm(Control control)
{
return;
}
}
}
Store Procedure
CREATE PROCEDURE GetHousesPageWise
#PageIndex INT = 1
,#PageSize INT = 5
,#RecordCount INT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER() OVER
(
ORDER BY [Name] ASC
)AS RowNumber
,[Id]
,[Name]
,[Townland]
,[Near]
,[Status]
,[Built]
INTO #Results
FROM [Houses]
SELECT #RecordCount = COUNT(*)
FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN(#PageIndex -1) * #PageSize + 1 AND(((#PageIndex -1) * #PageSize + 1) + #PageSize) - 1
DROP TABLE #Results
end
Houses.aspx

Change stored procedure's select query
SELECT ROW_NUMBER() OVER
(
ORDER BY [Name] ASC
)AS RowNumber
,[Id]
,[Name]
,[Townland]
,[Near]
,[Status]
,[Built]
,[Image]
INTO #Results
FROM [Houses]
and use
<img src='<%# Eval("Image") %>' alt="img" width="398" height="287"/>

First of all I advice to bind to datasource by using NetTiers model like this
and then you use Eval as this
"> />

Related

How to make ListView/DataView responsive in bootstrap

I'm making my first webshop. I want to load all my products from my sql database onto my page. so I use a listvieuw. but it is not responsive. I want my products next to each other on a medium screen and under each other on a small size screen like a phone
I tried to use bootstrap class's like "row" but now every new generated "template" is a row and they wil stand under each other on every screen size..if that makes sense?
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
<div class="row">
<asp:Button ID="Button1" runat="server" Text='<%#Eval("ProductNaam") %>' />
<br />
<br />
<div><%#Eval("ProductName") %></div>
<br />
<br />
<div><%#Eval("description") %></div>
<br />
<br />
<div><%#Eval("price") %></div>
</div>
</ItemTemplate>
</asp:ListView>
</div>
protected void Page_Load(object sender, EventArgs e)
{
using (SqlConnection objCn = new SqlConnection())
{
objCn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
using (SqlCommand objCmd = new SqlCommand())
{
objCmd.Connection = objCn;
objCmd.CommandType = System.Data.CommandType.Text;
objCmd.CommandText = "SELECT * FROM TblProducten;";
objCn.Open();
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = objCmd;
DataSet Myds = new DataSet();
Adapter.Fill(Myds);
ListView1.DataSource = Myds;
ListView1.DataBind();
}
}
}
I expected it to be responsive but it was not like I had already described
Wrap your "asp:ListView" in a div with the "row" class, then use the grid system columns to get the behavior you want.
The example below should help you to get started:
<div class="row">
<asp:ListView runat="server" ID="ListView1">
<ItemTemplate>
<div class="col-sm-4 border p-3">
<asp:Button ID="Button1" runat="server" Text='<%#Eval("ProductNaam") %>' />
<br />
<br />
<div><%#Eval("ProductName") %></div>
<br />
<br />
<div><%#Eval("description") %></div>
<br />
<br />
<div><%#Eval("price") %></div>
</div>
</ItemTemplate>
</asp:ListView>
</div>
As #Ben already mentioned, read the bootstrap docs around this subject:
https://getbootstrap.com/docs/4.2/layout/grid/

ItemDataBound slowing my page rendering

1My first question ever here, forgive if I am not fluent in tech language because I am a self taught developer from deep Africa Mozambique, thanks to this site.
My question is I have a
public void topicView_ItemDataBound(object sender,e)
In my code behind for a particular aspx page with a repeater, that receives its info from a datatable (if my terminology is correct.) The ItemDataBound event is to arrange my controls in a repeater for the purpose of hiding, disabling and showing other controls according to the determined criterias. Now I have noticed that the ItemDataBound event is slowing my page load time by some 20 to 40 seconds which is really bad, even on post back. When i remove the ItemDataBound events. I am running smoothly. But i can't work with out the ItemDataBound event since its the only way i know how to arrange a repeater with alternating conditions. Is this a common problem with a quick answer or should i post my full code?? this only happens on 2 pages with this event. I am using c# if thats of any help. net.4.5
public void topicView_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
// Show or hid div here
HiddenField MediaType = (HiddenField)e.Item.FindControl("MediaType");
HiddenField PageAdmin = (HiddenField)e.Item.FindControl("PageAdmin");
HiddenField f1 = (HiddenField)e.Item.FindControl("F1");
HiddenField PP = (HiddenField)e.Item.FindControl("PP");
HiddenField isread= (HiddenField)e.Item.FindControl("isread");
HiddenField tread = (HiddenField)e.Item.FindControl("tread");
// Label Label2 = (Label)e.Item.FindControl("Label2");
// Label2.Text = myDDL.Value;
System.Web.UI.HtmlControls.HtmlContainerControl image_video = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("image_video");
System.Web.UI.HtmlControls.HtmlContainerControl image_pic = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("image_pic");
System.Web.UI.HtmlControls.HtmlContainerControl PP1 = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("PP1");
System.Web.UI.HtmlControls.HtmlContainerControl userpic = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("userpic");
System.Web.UI.HtmlControls.HtmlContainerControl compic = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("compic");
System.Web.UI.HtmlControls.HtmlContainerControl userpic2 = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("userpic2");
System.Web.UI.HtmlControls.HtmlContainerControl compic2 = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("compic2");
System.Web.UI.HtmlControls.HtmlContainerControl pf = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("pf");
System.Web.UI.HtmlControls.HtmlContainerControl attach = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("attach");
LinkButton LinkButton3 = (LinkButton)e.Item.FindControl("LinkButton3");
LinkButton LinkButton1 = (LinkButton)e.Item.FindControl("LinkButton1");
Label Label4 = (Label)e.Item.FindControl("Label4");
Label Label10 = (Label)e.Item.FindControl("Label10");
System.Web.UI.WebControls.Image readsign = (System.Web.UI.WebControls.Image)e.Item.FindControl("readsign");
System.Web.UI.WebControls.Image Image2 = (System.Web.UI.WebControls.Image)e.Item.FindControl("Image2");
if (MediaType.Value == "video")
{
image_video.Visible = false;
image_pic.Visible = true;
Image2.ImageUrl = "~/images/readmail.png";
}
if (MediaType.Value == "image")
{
image_video.Visible = true;
image_pic.Visible = false;
}
if (MediaType.Value == "" ) { attach.Visible = false; } else { attach.Visible = true; }
if (PageAdmin.Value == "False")
{
compic.Visible = false;
userpic.Visible = true;
userpic2.Visible = true;
compic2.Visible = false;
}
if (PageAdmin.Value == "True")
{
userpic.Visible = false;
compic.Visible = true;
userpic2.Visible = false;
compic2.Visible = true;
}
if (isread.Value == "True")
{
readsign.ImageUrl = "~/images/readmail.png";
Label4.Text = "foi lido ";
Label10.Text = tread.Value;
}
}
}
and my aspx code for the repeater:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"
OnItemDataBound="topicView_ItemDataBound"><ItemTemplate>
<div id="messages" style="margin-bottom: 10px">
<asp:HiddenField ID="Status" runat="server"
Value='<%#""+Eval("Isreplyed") %>' />
<asp:HiddenField ID="Pageadmin" runat="server"
Value='<%#""+Eval("PageAdmin") %>'/>
<asp:HiddenField ID="MediaType" runat="server"
Value='<%#""+Eval("MediaType") %>' />
<asp:HiddenField ID="isread" runat="server" Value='<%#""+Eval("Isread")
%>' />
<asp:HiddenField ID="tread" runat="server" Value='<%#""+Eval("tread","
{0:d / MM " + "#" + " HH:mm}") %>' />
<div id="Omsg" style="padding: 5px; border: thin solid #FFFFFF; box-
shadow:rgba(255, 255, 255,0.9) 0 0 7px; background-color: #FFFFFF;border-
radius:5px; " >
<table style="width: 100%; text-align: left; margin-left: 0px;">
<tr><td colspan="2">
<asp:Image ID="readsign" runat="server" Height="25" Width="25"
ImageUrl="~/images/newmail.png" />
<asp:Label ID="Label4" runat="server" Text='<%# ""+Eval("Isreplyed")
%>' Font-Size="X-Small" ForeColor="#999999"></asp:Label>
<asp:Label ID="Label10" runat="server" Text='<%#""+Eval("datesent","{0:d /
MM " + "#" + " HH:mm}") %>' Font-Size="X-Small" ForeColor="#999999">
</asp:Label>
</td></tr>
<tr>
<td style="width: 66px; text-align: left;"><a id="pps" ><div
id="compic" ClientIDMode="Static" runat="server"><img id="PP1" alt=""
class="img-rounded" src='<%#"/ProfilePictures/"+Eval("logo") %>'
style="width: 50px; height: 50px" /></div><input id="Hidden2" type="hidden"
runat="server" value='<%#"/ProfilePictures/"+Eval("logo") %>' /></a>
<div id="userpic" clientidmode="Static" runat="server">
<img alt="" class="img-circle"
src='<%#"/ProfilePictures/"+Eval("ProfilePicture") %>' style="width: 50px;
height: 50px" />
</div><input id="Hidden3" type="hidden" runat="server"
value='<%#"/ProfilePictures/"+Eval("ProfilePicture") %>' />
</td>
<td style="line-height: 15px"> <div id="compic2"
ClientIDMode="Static" runat="server"> <a href='<%#"/Landing.aspx?
Restid="+Eval("id") %>' ><asp:Label ID="Label2" class="head" runat="server"
Text='<%# ""+Eval("name") %>' Font-Size="Medium" ForeColor="#B9A47B">
</asp:Label> </a><a/><br/>
<asp:Label ID="CName" runat="server"
Text='<%#""+Eval("slogan") %>' Font-Size="Smaller"></asp:Label>. ...</div>
<div id="userpic2" ClientIDMode="Static"
runat="server"><a href='<%#"/Landing.aspx?Restid="+Eval("Username") %>' >
<asp:Label ID="Label8" class="head" runat="server"
Text='<%#""+Eval("Username") %>' Font-Size="Large" ForeColor="#B9A47B">
</asp:Label> <a/><br/>
<asp:Label ID="Label9" runat="server"
Text='<%#""+Eval("Job") %>' Font-Size="Smaller"></asp:Label></a>
<br />
<a/>
<a href='<%#"notificationmaster.aspx?BlogId="+Eval("Blogid") %>'> <asp:Label
ID="Label5" runat="server" Text='<%# "Respondendo à publicação :
"+Eval("BlogTitle") %>' Font-Size="smaller" ForeColor="#B9A47B"></asp:Label>
</a><br/>
</div>
<a/><span style="font-size: x-small; color: #999999">
enviado : </span><asp:Label ID="Label3" runat="server"
Text='<%#""+Eval("datesent","{0:d MMMM yyyy - HH:mm}") %>' Font-Size="X-
Small" ForeColor="#999999"></asp:Label></a>
<br />
<div id="attach" ClientIDMode="Static" runat="server" >
<asp:Label ID="Label17" runat="server" Text="Esta mensagem tem anexo"
ForeColor="#999999" Font-Size="X-Small" Font-Underline="True">
</asp:Label> <img alt="" src="images/attach.png" style="width: 20px;
height: 20px" /></div>
</td>
</tr>
<tr>
<td colspan="2">
<br/>
<div id="msgbody" style="display: none">
<asp:Label ID="Label1" runat="server" Text='<%#""+Eval("mbody") %>'>
</asp:Label><br/>
<div id="image_pic" ClientIDMode="Static" runat="server" >
<asp:HiddenField ID="HiddenField1" runat="server"
Value='<%#"/PostImages/"+Eval("image") %>' />
<asp:Image ID="Image1" class="img-thumbnail" ClientIDMode="Static"
runat="server" ImageUrl='<%#"/PostImages/"+Eval("image") %>' alt="Broken"
Width="100%" />
</div>
<div id="image_video" runat="server" onclick="AddView" >
<video id="PostVedio" runat="server" controls
poster="/images/chimoioonline.png" src='<%#"/video/"+Eval("video") %>'
style="width: 100%">
<source src="demo.mp4" type="video/mp4" />
<source src="demo.webm" type="video/webm"/>
<source src="demo.ogv" type="video/ogg"/>
<source src="demo.ogv" type="video/avi"/>
<p>Fallback code if video isn't supported</p>/
</video></div></div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right">
<hr style="padding: 2px; margin: 5px" />
<div id="deletm" style="display: inline-block">
<input id="Hidden1" type="hidden" runat="server"
value='<%#Eval("id")%>' />
<asp:LinkButton ID="LinkButton3" runat="server" CssClass="btn"
onclick="pmdelet" BorderColor="#CCCCCC" BorderWidth="1px"><img
src="/images/delete.png" alt="" style=" height: 15px" />
</asp:LinkButton> <br />
</div>
<div id="sendpm" style="display: inline-block">
<input id="mido" type="hidden" runat="server"
value='<%#Eval("id")%>' />
<input id="Hidden4" type="hidden" runat="server"
value='<%#Eval("BlogId")%>' />
<input id="sender2" type="hidden" runat="server"
value='<%#Eval("sender")%>' />
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn"
BorderColor="#CCCCCC" BorderWidth="1px" OnClientClick=""
PostBackUrl='<%#"PMS.aspx?id=" + Eval("id") + "&BlogId=" + Eval("BlogId")+
"&sender=" + Eval("sender")%>' ><img src="images/pvtemail.png" alt=""
style=" height: 15px" /></asp:LinkButton>
</div>
<div id="read" style="display: inline-block">
<input id="H5" type="hidden" runat="server"
value='<%#Eval("id")%>' />
<input id="H7" type="hidden" runat="server"
value='<%#"/ProfilePictures/"+Eval("logo") %>' />
<input id="H8" type="hidden" runat="server"
value='<%#"/ProfilePictures/"+Eval("ProfilePicture") %>' />
<input id="H6" type="hidden" runat="server"
value='<%#Eval("Isreplyed")%>' />
<input id="H14" type="hidden" runat="server"
value='<%#Eval("Username")%>' />
<input id="H10" type="hidden" runat="server"
value='<%#Eval("name")%>' />
<input id="H13" type="hidden" runat="server"
value='<%#Eval("Subject")%>' />
<input id="H9" type="hidden" runat="server"
value='<%#Eval("BlogTitle")%>' />
<input id="H11" type="hidden" runat="server"
value='<%#Eval("datesent","{0:d / MM " + "#" + " HH:mm}")%>' />
<input id="H12" type="hidden" runat="server"
value='<%#Eval("mbody")%>' />
<input id="v5" type="hidden" runat="server" value='<%#
Eval("video")%>' />
<input id="p5" type="hidden" runat="server"
value='<%#Eval("image")%>' />
<input id="sender" type="hidden" runat="server"
value='<%#Eval("sender")%>' />
<input id="Hidden5" type="hidden" runat="server"
value='<%#Eval("Blogid")%>' />
<input id="PageAdmin2" type="hidden" runat="server"
value='<%#Eval("PageAdmin")%>' />
<asp:LinkButton ID="LinkButton2" runat="server" CssClass="btn"
BorderColor="#CCCCCC" BorderWidth="1px" OnClientClick="return false"><img
src="/images/read2.png" alt="" style=" height:15px" /></asp:LinkButton>
</div>
</td>
</tr>
</table>
</div>
<div id="Rmsg">
</div>
</div>
</ItemTemplate></asp:Repeater>
My Server profiler screen shot
This is not really an answer, but more a way for you to delve deeper into whats the problem. (And it's to long for a comment)
First of all you need to make sure you have SQL server managment tools installed, in particular you need the tool called SQL server profiler.
In profiler you go to "file" "new trace" and connect to you SQL server.
In the Trace properties you select only "RPC:completed" and "SQL:BatchCompleted".
Now you can run your aspx page, and you should se all SQL queries generated by the page in the profiler. There are two things you should look out for.
First of all, look for long running queries. The duration column is in MS and you should not have anyone longer than 1000ms.
Secondly, the number of queries run when the page is run. A normal page should not exceed 20 queries. Usualy when you get problems with this, you could run hundreds.

Insert Into stored procedure not working

I'm trying to insert into a table using a stored procedure. The executed stored produce results in zero (0). I guess which means the stored procedure is successful.
But when I look at the table, the record is not added. How can I fix it?
SQL
ALTER PROCEDURE displayToDO
#ID int =2,
#Title varchar(50),
#Description varchar(255),
#Date date,
#Time time,
#Location varchar(50),
#Priority varchar(20),
#NotificationType varchar(30)
AS
BEGIN
INSERT INTO toDOLIST(ID, Title, Description, Date, Time, Location, Priority, NotificationTYPE)
VALUES (#Title, #Description, #Date, #Time, #Location, #Priority, #NotificationType)
END
Asp.net:
<form id="form1" runat="server">
<div>
<div class="insertData">
<asp:Label ID="title" runat="server" Text="Title"></asp:Label>
<asp:TextBox ID="titleBox" runat="server"></asp:TextBox><br />
<asp:Label ID="description" runat="server" Text="Description"></asp:Label>
<asp:TextBox ID="descriptionBox" runat="server"></asp:TextBox><br />
<asp:Label ID="dateLabel" runat="server" Text="Date"></asp:Label>
<asp:Calendar ID="date" runat="server"></asp:Calendar><br />
<asp:Label ID="time" runat="server" Text="Time"></asp:Label>
<asp:TextBox ID="timeBoxHr" runat="server"></asp:TextBox> <asp:TextBox ID="timeBoxMin" runat="server"></asp:TextBox>
<br />
<asp:Label ID="location" runat="server" Text="Location"></asp:Label>
<asp:TextBox ID="locationBox" runat="server"></asp:TextBox><br />
<asp:Label ID="priority" runat="server" Text="Priority"></asp:Label>
<asp:DropDownList ID="priorityDrop" runat="server">
<asp:ListItem>-</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList>
<br />
<asp:Label ID="notification" runat="server" Text="Notification Type"></asp:Label>
<asp:DropDownList ID="notificationDrop" runat="server">
<asp:ListItem>12 hrs before</asp:ListItem>
<asp:ListItem>1 day Before</asp:ListItem>
<asp:ListItem>3 Day before</asp:ListItem>
<asp:ListItem>A Week before</asp:ListItem>
</asp:DropDownList>
</div>
<br />
<asp:Button ID="Button2" runat="server" Text="Insert" onclick="Button2_Click" />
<br /><br /><br /><br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Display" />
<br /><br /><br /><br />
<asp:GridView ID="GridView1" runat="server"
onselectedindexchanged="GridView1_SelectedIndexChanged">
</asp:GridView>
</div>
</form>
C#:
protected void Button2_Click(object sender, EventArgs e)
{
String time = timeBoxHr.Text + ":" + timeBoxMin.Text + ":00";
using (SqlConnection conn = new SqlConnection(ConfigurationString))
{
SqlCommand scommand = new SqlCommand(sql, conn);
scommand.CommandType = CommandType.StoredProcedure;
scommand.Parameters.Add("#ID", SqlDbType.Int).Value = titleBox.Text;
scommand.Parameters.Add("#Title", SqlDbType.VarChar, 50).Value = titleBox.Text;
scommand.Parameters.Add("#Description", SqlDbType.VarChar, 255).Value = descriptionBox.Text;
scommand.Parameters.Add("#Date", SqlDbType.Date).Value = date.SelectedDate.ToShortDateString();
scommand.Parameters.Add("#Time", SqlDbType.Time).Value = time;
scommand.Parameters.Add("#Location", SqlDbType.VarChar, 50).Value = locationBox.Text;
scommand.Parameters.Add("#Priority", SqlDbType.VarChar, 20).Value = priorityDrop.Text;
scommand.Parameters.Add("#NotificationType", SqlDbType.VarChar, 30).Value = notificationDrop.Text;
try
{
if (scommand.Connection.State == ConnectionState.Closed)
{
scommand.Connection.Open();
}
scommand.ExecuteNonQuery();
}
catch (Exception)
{
}
finally
{
scommand.Connection.Close();
}
}

Error inserting into database

I have a web form which is basically this,
my page has LABELS, BUTTONS, GRIDVIEW, TEXTBOXES
DATA shown came from ANOTHER DATABASE
whenever i try to INSERT into another database (again)
ERROR occurs saying:
An explicit value for the identity column in table 'PO2' can only be
specified when a column list is used and IDENTITY_INSERT is ON.
I am using Sql server
ASPNET CODES:
<table class="col-lg-12">
<tr>
<td class="style5">
Shipping Method</td>
<td class="style6">Shipping Term</td>
<td class="style6">Payment Term</td>
<td class="style4">Delivery Date</td>
<td class="style4">Final Delivery Date</td>
</tr>
<tr>
<td>
<asp:Label ID="lbShippingMethod" runat="server" BorderColor="Black" Font-Size="Larger" /></td>
<td>
<asp:Label ID="lbShippingTerm" runat="server" BorderColor="Black" Font-Size="Larger" /></td>
<td>
<asp:Label ID="lbPaymentTerm" runat="server" BorderColor="Black" Font-Size="Larger" /></td>
<td>
<asp:Label ID="lbDeliveryDate" runat="server" BorderColor="Black" Font-Size="Larger" /></td>
<td>
<asp:Textbox ID="txtDate" runat="server" BorderColor="Black" Font-Size="Larger" type="date" /></td>
</tr>
<tr>
<td>
<br />
<br />
</td>
</tr>
</div>
</table>
<div class="container">
<div class="col-lg-10 pull-right">
<table class="col-lg-12">
<tr>
<td>
PR#</td>
<td class="style2">
Product Name
</td>
<td>Product#</td>
<td>Price</td>
<td>
Quantity
</td>
</tr>
<tr>
<td>
<asp:Label ID="PRID" runat="server" BorderColor="Black" Font-Size="Larger" />
</td>
<td>
<asp:DropDownList ID="ddlName" runat="server" class="form-control"
Width="150px" onselectedindexchanged="ddlName_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
</td>
<td class="style2">
<asp:Label ID="lbProductID" runat="server" Width="90px"></asp:Label>
</td>
<td class="style2">
<asp:Label ID="lbPrice" runat="server"></asp:Label>
</td>
<td>
<asp:TextBox ID="Quantity" runat="server" Width="90px" Type="Number" required></asp:TextBox>
</td>
<td>
<asp:Label ID="Amount" runat="server" Width="90px" Type="Number" required> </asp:Label>
</td>
<div class="pull-right">
<td><asp:Button ID="btnAdd" runat="server" class="btn btn-default"
style="background-color:Silver" text="Add Product" ForeColor="Black"
onclick="btnAdd_Click" />
</td>
</div>
</tr>
</table>
</div>
</div>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="1000px" HorizontalAlign="Center"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="PRID" HeaderText="PRID" SortExpression="PRID" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID"
SortExpression="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName"
SortExpression="ProductName" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity"
SortExpression="Quantity" />
<asp:BoundField DataField="Amount" HeaderText="Amount"
SortExpression="Amount" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyOwnMeatshopConnectionString %>"
SelectCommand="SELECT [PRID], [ProductID], [ProductName], [Price], [Quantity], [Amount] FROM [PRDetails] WHERE ([PRID] = #PRID)">
<SelectParameters>
<asp:QueryStringParameter Name="PRID" QueryStringField="ID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<div class="container">
<div class="pull-right col-lg-5">
<h4 />SUB TOTAL Php <asp:Label ID="lbSubTotal" runat="server"></asp:Label>
<h4 />VAT (12%)
Php <asp:Literal ID="ltVAT" runat="server"></asp:Literal>
<h4 />TOTAL Php <asp:Literal ID="ltTotal" runat="server"> </asp:Literal>
</div>
</div>
<div class="pull-right">
<td>
<asp:Button ID="btnSum" runat="server" class="btn btn-default" style="background-color:Silver" text="TOTAL" ForeColor="Black" />
</td>
</div>
<br />
<br />
<br />
<br />
<div class="form-group">
<label class="control-label col-lg-4">Remarks</label>
<div class="col-lg-8">
<asp:TextBox ID="txtRemarks" runat="server" class="form- control" MaxLength="100" TextMode="MultiLine" />
</div>
</div>
<div class="pull-right">
<div class="form-group">
<asp:Button ID="btnApprove" runat="server" class="btn btn-success" text="Approve"
onclick="btnApprove_Click" />
<asp:Button ID="btnCancel" runat="server" class="btn" style="color:White" text="Disapprove" BackColor="Black" PostBackUrl="~/Default.aspx" />
</div>
</div>
</div>
</form>
HERE is BTN codes (APPROVE)
void addtoPO()
{
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "INSERT INTO PO2 VALUES (#UserID, #SupplierID, #CompanyName, #ShippingMethod, " +
"#ShippingTerm, #Term, #DeliveryDate, #ModifiedBy, #DateModified, #Status, #Remarks, #PODate, #DeliveryDate)";
cmd.Parameters.AddWithValue("#UserID", Session["userid"].ToString());
cmd.Parameters.AddWithValue("#SupplierID", lbSupplierID.Text);
cmd.Parameters.AddWithValue("#CompanyName", lbCompName.Text);
cmd.Parameters.AddWithValue("#ShippingMethod", lbShippingMethod.Text);
cmd.Parameters.AddWithValue("#ShippingTerm", lbShippingTerm.Text);
cmd.Parameters.AddWithValue("#Term", lbPaymentTerm.Text);
cmd.Parameters.AddWithValue("#ModifiedBy", lbFNA.Text + lbLNA.Text);
cmd.Parameters.AddWithValue("#DateModified", DateTime.Now);
cmd.Parameters.AddWithValue("#Status", "Approved");
cmd.Parameters.AddWithValue("#Remarks", txtRemarks.Text);
cmd.Parameters.AddWithValue("#PODate", DateTime.Now);
cmd.Parameters.AddWithValue("#DeliveryDate", txtDate.Text);
cmd.ExecuteNonQuery();
con.Close();
}
protected void btnApprove_Click(object sender, EventArgs e)
{
addtoPO();
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
int ProductID = int.Parse(GridView1.Rows[row.RowIndex].Cells[1].Text);
string ProductName = GridView1.Rows[row.RowIndex].Cells[2].Text;
decimal Price = decimal.Parse(GridView1.Rows[row.RowIndex].Cells[3].Text);
int Quantity = int.Parse(GridView1.Rows[row.RowIndex].Cells[4].Text);
int Amount = int.Parse(GridView1.Rows[row.RowIndex].Cells[5].Text);
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "INSERT INTO PODetails (ProductID, Name, Price, Quantity, Amount) " +
"VALUES (#ProductID, #Name, #Price, #Quantity, #Amount)";
//cmd.Parameters.AddWithValue("#UserID", Session["userid"].ToString());
cmd.Parameters.Add("#ProductID", SqlDbType.VarChar).Value = ProductID;
cmd.Parameters.Add("#Name", SqlDbType.VarChar).Value = ProductName.ToString();
cmd.Parameters.Add("#Price", SqlDbType.Decimal).Value = Price;
cmd.Parameters.Add("#Quantity", SqlDbType.Int).Value = Quantity;
cmd.Parameters.Add("#Amount", SqlDbType.Int).Value = Amount;
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
GridView1.DataBind();
//con.Open();
//cmd.CommandText = "DELETE FROM Orders";
//cmd.Parameters.Add("#RefNo", RefNo);
con.Close();
}
}
I am INSERTING INTO TWO different tables that's why insert are separated and other values are being GET into GRIDVIEW.
I Have turning on and off the is identity but didn't work.
Other insert that i have are all good this was just the one has error.
insert into TABLE ([column list])
values ([values list])
you have not listed inserted column list thus server tries to fulfill all the columns "left to right". next error would be about not enough values provided for table columns. Currently it tries to post #UserID into PO2.ID, #SupplierID into PO2.UserID and so on.
Thank you for answering guys really appreciate it!
Forgive my questions because i am super new to hard codes c# and asp.net
i just followed the answer of mr #Ivan Starostin
cmd.CommandText = "INSERT INTO PO2 (UserID, SupplierID, CompanyName, ShippingMethod, " +
"ShippingTerm, Term, ModifiedBy, DateModified, Status, Remarks, PODate, DeliveryDate, FinalDeliveryDate, PRID) VALUES (#UserID, #SupplierID, #CompanyName, #ShippingMethod, " +
"#ShippingTerm, #Term, #ModifiedBy, #DateModified, #Status, #Remarks, #PODate, #DeliveryDate, #FinalDeliveryDate, #PRID)";
did it like this and fixed some column insert statement and worked!

Displaying specific information on aspx page using database

I am building a website with ASP.NET Web Forms, and a SQL database.
On one particular page I have a number of houses with some informations.
There are 571 houses in total.
When I click on a particular house, I want to bring up a new page with more information about that house.
All the data is coming from a table in the database.
Is there a way of knowing which house has been selected, and display the data on the new aspx page for that house?
I know I could create many separate aspx pages for each house but there are 571 houses and there would have to be 571 aspx pages. That is far too much wasted code.
When I click on the house name I want only one aspx page but I want it to know that I have selected that house and display the information for that specific one. Like its accessing the database information for that house and displays it.
The main obstacle here is knowing what house has been selected. I know how to display information from a database.
Houses.aspx
When I click a house name I want to display a page like the one below.
HouseInfo.aspx
HouseInfo.aspx.cs
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
using (SqlCommand command = new SqlCommand("SELECT Id, Name, Townland, Near, Status, Built, Description, Families FROM Houses ORDER BY Name DESC", connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
lblId.Text = reader[0].ToString();
lblName.Text = reader[1].ToString();
lblTown.Text = reader[2].ToString();
lblNear.Text = reader[3].ToString();
lblStatus.Text = reader[4].ToString();
lblBuilt.Text = reader[5].ToString();
lblDesc.Text = reader[6].ToString();
lblFam.Text = reader[7].ToString();
}
}
}
}
}
This is how I am accessing the database to display some of the info on the HouseInfo page already.
HouseInfo.aspx
<b>ID:</b> <asp:Label ID="lblId" runat="server"></asp:Label>
<br /><b>Name of House:</b> <asp:Label ID="lblName" runat="server"></asp:Label>
<br /><b>Townland:</b> <asp:Label ID="lblTown" runat="server"></asp:Label>
<br /><b>Near:</b> <asp:Label ID="lblNear" runat="server"></asp:Label>
<br /><b>Status/Public Access:</b> <asp:Label ID="lblStatus" runat="server </asp:Label>
<br /><b>Date Built:</b> <asp:Label ID="lblBuilt" runat="server"></asp:Label>
<br /><b>Description:</b> <asp:Label ID="lblDesc" runat="server"></asp:Label>
<br /><b>Associated Families:</b> <asp:Label ID="lblFam" runat="server"></asp:Label>
Houses.aspx
<%# Page Title="Houses" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Houses.aspx.cs" Inherits="Houses_of_Mayo.images.Houses" EnableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script>
$(function () { setCurrentTab('tab2'); });
</script>
<div class="box">
<div>
<div class="body">
<h1>Houses</h1>
<ul id="rooms">
<asp:Repeater ID="rptData" runat="server" >
<ItemTemplate>
<li>
<a href="HouseInfo.aspx">
<img src="x" alt="img" /></a>
<h2>
<asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label></h2>
<p>
<b>ID: </b>
<asp:Label runat="server" Text='<%# Eval("Id") %>'></asp:Label>
<br />
<b>Name of House: </b>
<asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label>
<br />
<b>Townland: </b>
<asp:Label runat="server" Text='<%# Eval("Townland") %>'></asp:Label>
<br />
<b>Near: </b>
<asp:Label runat="server" Text='<%# Eval("Near") %>'></asp:Label>
<br />
<b>Status/Public Access: </b>
<asp:Label runat="server" Text='<%# Eval("Status") %>'></asp:Label>
<br />
<b>Date Built: </b>
<asp:Label runat="server" Text='<%# Eval("Built") %>'></asp:Label>
</p>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
<asp:Repeater ID="rptPager" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkPage" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
style="padding:8px; margin:2px; background:#ac9e94; border:solid 1px #666; font:8pt; color:#594334; display: inline-block;"
CssClass='<%# Convert.ToBoolean(Eval("Enabled")) ? "page_enabled" : "page_disabled" %>'
OnClick="Page_Changed" OnClientClick='<%# !Convert.ToBoolean(Eval("Enabled")) ? "return false;" : "" %>'></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</asp:Content>
Houses.aspx.cs
private int PageSize = 5;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GetCustomersPageWise(1);
}
}
private void GetCustomersPageWise(int pageIndex)
{
string constring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("GetHousesPageWise", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#PageIndex", pageIndex);
cmd.Parameters.AddWithValue("#PageSize", PageSize);
cmd.Parameters.Add("#RecordCount", SqlDbType.Int, 4);
cmd.Parameters["#RecordCount"].Direction = ParameterDirection.Output;
con.Open();
IDataReader idr = cmd.ExecuteReader();
rptData.DataSource = idr;
rptData.DataBind();
idr.Close();
con.Close();
int recordCount = Convert.ToInt32(cmd.Parameters["#RecordCount"].Value);
this.PopulatePager(recordCount, pageIndex);
}
}
}
private void PopulatePager(int recordCount, int currentPage)
{
double dblPageCount = (double)((decimal)recordCount / Convert.ToDecimal(PageSize));
int pageCount = (int)Math.Ceiling(dblPageCount);
List<ListItem> pages = new List<ListItem>();
if (pageCount > 0)
{
for (int i = 1; i <= pageCount; i++)
{
pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
}
}
rptPager.DataSource = pages;
rptPager.DataBind();
}
protected void Page_Changed(object sender, EventArgs e)
{
int pageIndex = int.Parse((sender as LinkButton).CommandArgument);
this.GetCustomersPageWise(pageIndex);
}
Map (HouseInfo.aspx)
HouseInfo.aspx
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(53.613873, -9.668301);
var mapOptions = {
zoom: 17,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var contentString = '<div id="content">' +
'<div id="siteNotice">' +
'</div>' +
'<h2 id="firstHeading" class="firstHeading">Aasleagh Lodge</h2>' +
'<div id="bodyContent">' +
'<b>ID:</b> A1' +
'</br><b>Name:</b> Aasleagh Lodge' +
'</br><b>Townland:</b> Srahatloe' +
'</br><b>Ref:</b> 1' +
'</br><b>Latitude:</b> 53.613873' +
'</br><b>Longitude:</b> -9.668301' +
'</div>' +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var image = 'Images/icon56.png';
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Aasleagh Lodge',
icon: image
});
google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
HouseInfo Table
[Id] CHAR (10) NOT NULL,
[Name] NVARCHAR (MAX) NULL,
[Townland] NVARCHAR (MAX) NULL,
[Ref] INT NULL,
[Lat] FLOAT (53) NULL,
[Lng] FLOAT (53) NULL,
CONSTRAINT [PK_HouseInfo] PRIMARY KEY CLUSTERED ([Id] ASC)
There are multiple ways to do that. Best (IMO) and easiest is to use query string to pass the ID (or primary key data) of the selected house to the next web-form and display data using that value.
in this code you are sending Id of house to other page.
<a href='<%# "HouseInfo.aspx?HouseId=" + Eval("Id").ToString() %>'>
<img src="x" alt="img" /></a>
and here you are getting that Id back
string HouseId = Request.Params["HouseId"].ToString();
also in here you are filtering your data to only get that houses information
"SELECT Id, Name, Townland, Near, Status, Built, Description, Families FROM Houses WHERE Id = '" + HouseId + "' ORDER BY Name DESC"
complete code ;
HouseInfo.aspx.cs
string HouseId = Request.Params["HouseId"].ToString();
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
using (SqlCommand command = new SqlCommand("SELECT Id, Name, Townland, Near, Status, Built, Description, Families FROM Houses WHERE Id = '" + HouseId + "' ORDER BY Name DESC", connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
lblId.Text = reader[0].ToString();
lblName.Text = reader[1].ToString();
lblTown.Text = reader[2].ToString();
lblNear.Text = reader[3].ToString();
lblStatus.Text = reader[4].ToString();
lblBuilt.Text = reader[5].ToString();
lblDesc.Text = reader[6].ToString();
lblFam.Text = reader[7].ToString();
}
}
}
}
Houses.aspx
<ul id="rooms">
<asp:Repeater ID="rptData" runat="server" >
<ItemTemplate>
<li>
<a href='<%# "HouseInfo.aspx?HouseId=" + Eval("Id").ToString() %>'>
<img src="x" alt="img" /></a>
<h2>
<a href='<%# "HouseInfo.aspx?HouseId=" + Eval("Id").ToString() %>'><asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label></a></h2>
<p>
<b>ID: </b>
<asp:Label runat="server" Text='<%# Eval("Id") %>'></asp:Label>
<br />
<b>Name of House: </b>
<asp:Label runat="server" Text='<%# Eval("Name") %>'></asp:Label>
<br />
<b>Townland: </b>
<asp:Label runat="server" Text='<%# Eval("Townland") %>'></asp:Label>
<br />
<b>Near: </b>
<asp:Label runat="server" Text='<%# Eval("Near") %>'></asp:Label>
<br />
<b>Status/Public Access: </b>
<asp:Label runat="server" Text='<%# Eval("Status") %>'></asp:Label>
<br />
<b>Date Built: </b>
<asp:Label runat="server" Text='<%# Eval("Built") %>'></asp:Label>
</p>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>

Categories

Resources