<asp:FormView ID="FormView1" runat="server" AllowPaging="true" Width="552px" >
<ItemTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="contenttext" style="height: 20px; width: 468px;"> <p> </p>
<p><span class="contenttext"><b><%# Eval("building") %></b></span><br />
<span class="contenttext"><%# Eval("addr") %></span></p></td>
<td class="contenttext" style="height: 20px" valign="top" align="right">
<a href="pro_print.aspx?b=<%# Eval("building") %>&r=<%=Request.QueryString["r"] %>"><img src="images/print.gif" border="0" /></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" valign="top" style="height: 19px"><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td valign="top" class="photo"> <asp:FormView ID="FormView2" runat="server">
<ItemTemplate>
<table width="291" border="0" cellspacing="0" cellpadding="0">
<tr>
<img id="zoom" src="readimg.aspx?id=<%# Eval("p_id") %>&ref=<%# Eval("ref") %>" width="291" height="232" alt="" />
</tr>
</table>
</ItemTemplate>
</asp:FormView>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
<ItemTemplate>
<table border="0" cellspacing="0" cellpadding="0" style="width: 56px">
<tr>
<td> <img src='readimg.aspx?id=<%# Eval("p_id") %>&ref=<%# Eval("ref")%> 'width="55" height="52" onclick="document.getElementById('zoom').src=this.src" style="cursor:pointer;" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<hr align="left" width="291" size="1" noshade="noshade" />
<table width="291" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" class="contenttext"><strong>Enquire about this property<br /></strong></td>
</tr>
<tr>
<td width="169"><input name="textfield" type="text" class="formbox" value="Name" /></td>
<td> </td>
</tr>
<tr>
<td width="169"><input name="textfield4" type="text" class="formbox" value="Phone Number" /></td>
<td> </td>
</tr>
<tr>
<td width="169"><input name="textfield5" type="text" class="formbox" value="Email" /></td>
<td><a href="#"><img src="images/but_submit.gif" width="50" height="19" border="0" id="Image8" onmouseover="MM_swapImage('Image8','','images/but_submit_h.gif',1)" onmouseout="MM_swapImgRestore()" alt="" /></a></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" class="contenttext"><strong>Contact Us</strong><br />
Leasing Department<br />
852-2822-6800<br />
<span class="propertyblue"><a href="mailto:[email protected]">[email protected]</a><br />
<br />
<a href="search_result.aspx?keyword=<%# Eval("building") %>">Search other units in this building</a></span></td>
</tr>
</table>
<p> </p></td>
<td width="210" valign="top"><p class="property"><strong>High-rise apartments<br />HK$<%# Eval("rental", "{0:0,0}")%>
<asp:Label ID="Label1" runat="server" Text="inclusive per month" Visible='<%# (bool)(Eval("mgmt").ToString()=="999999") %>'></asp:Label></strong></p>
<p class="property"><strong>Layout</strong><br />
Size: <%# Eval("area", "{0:0,0}")%> sq ft<br />
<%# Eval("bedrooms") %> Bedroom<br />
<%# Eval("bathrooms") %> Bathroom</p>
<p class="property"><strong>Property Description</strong><br />
<%# Eval("property_desc") %></p> <p class="property"><strong>Facilities </strong>
<%# Eval("fac1") %>
<%# Eval("fac2") %>
<%# Eval("fac3") %></p>
<p class="property"><strong>Enquire about this property</strong><br />
Residential Leasing Department<br />
852-2822-6800<br />
<span class="propertyblue"> <a href="mailto:[email protected]">[email protected]</a></SPAN></p> <p class="contenttextbold"> </p>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView> keyword.Attributes.Add("onfocus", "this.value=''");
DBFun db = new DBFun();
string sql = "";
if (!string.IsNullOrEmpty(Request.QueryString["b"]))
{
sql = "select top 1 b.mgmt,a.building,a.add1 + ','+a.add2 as addr,b.rental,b.area,b.bedrooms,b.bathrooms,"
+ "isnull(b.rem8,'')+isnull(b.rem9,'')+isnull(b.rem10,'')+isnull(b.rem11,'')+isnull(b.rem12,'')+isnull(b.rem13,'')+isnull(b.rem14,'')+isnull(b.rem15,'')+isnull(b.rem16,'')+isnull(b.rem17,'') as property_desc,"
+ "isnull(a.rem1,'')+isnull(a.rem2,'')+isnull(a.rem3,'')+isnull(a.rem4,'')+isnull(a.rem5,'')+isnull(a.rem6,'')+isnull(a.rem7,'')+isnull(a.rem8,'')+isnull(a.rem9,'') as location_desc,"
+ "case isnull(a.fac1,'') when '' then '' else '<br />• '+a.fac1 end as fac1, "
+ "case isnull(a.fac2,'') when '' then '' else '<br />• '+a.fac2 end as fac2, "
+ "case isnull(a.fac3,'') when '' then '' else '<br />• '+a.fac3 end as fac3 from building a,lease b where a.building=b.building and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and b.ref=" + Request.QueryString["r"];
DataSet ds = db.GetDataSetSql(sql);
FormView1.DataSource = ds;
FormView1.DataBind();
ds.Clear(); //sql = "select a.sysid,b.photo_name,a.building,a.ref from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "'";
sql = " select a.sysid,a.building,a.ref,p_id from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and a.ref=" + Request.QueryString["r"] + " union all select a.sysid,a.building,'0',p_id from building a,building_photo b where a.sysid=b.building_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' order by ref";
TextBox1.Text = sql;
DataTable dt1 = db.GetDataTable(sql);
FormView fv2 = (FormView)FormView1.FindControl("FormView2"); fv2.DataSource = dt1;
fv2.DataBind();
dt1.Clear();
DataTable dt=db.GetDataTable(sql);
DataList datalist1=(DataList)FormView1.FindControl("DataList1");
if (datalist1 !=null)
{
datalist1.DataSource = dt;
datalist1.DataBind();
}
dt.Clear();
<ItemTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="contenttext" style="height: 20px; width: 468px;"> <p> </p>
<p><span class="contenttext"><b><%# Eval("building") %></b></span><br />
<span class="contenttext"><%# Eval("addr") %></span></p></td>
<td class="contenttext" style="height: 20px" valign="top" align="right">
<a href="pro_print.aspx?b=<%# Eval("building") %>&r=<%=Request.QueryString["r"] %>"><img src="images/print.gif" border="0" /></a></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" valign="top" style="height: 19px"><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td valign="top" class="photo"> <asp:FormView ID="FormView2" runat="server">
<ItemTemplate>
<table width="291" border="0" cellspacing="0" cellpadding="0">
<tr>
<img id="zoom" src="readimg.aspx?id=<%# Eval("p_id") %>&ref=<%# Eval("ref") %>" width="291" height="232" alt="" />
</tr>
</table>
</ItemTemplate>
</asp:FormView>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
<ItemTemplate>
<table border="0" cellspacing="0" cellpadding="0" style="width: 56px">
<tr>
<td> <img src='readimg.aspx?id=<%# Eval("p_id") %>&ref=<%# Eval("ref")%> 'width="55" height="52" onclick="document.getElementById('zoom').src=this.src" style="cursor:pointer;" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<hr align="left" width="291" size="1" noshade="noshade" />
<table width="291" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2" class="contenttext"><strong>Enquire about this property<br /></strong></td>
</tr>
<tr>
<td width="169"><input name="textfield" type="text" class="formbox" value="Name" /></td>
<td> </td>
</tr>
<tr>
<td width="169"><input name="textfield4" type="text" class="formbox" value="Phone Number" /></td>
<td> </td>
</tr>
<tr>
<td width="169"><input name="textfield5" type="text" class="formbox" value="Email" /></td>
<td><a href="#"><img src="images/but_submit.gif" width="50" height="19" border="0" id="Image8" onmouseover="MM_swapImage('Image8','','images/but_submit_h.gif',1)" onmouseout="MM_swapImgRestore()" alt="" /></a></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" class="contenttext"><strong>Contact Us</strong><br />
Leasing Department<br />
852-2822-6800<br />
<span class="propertyblue"><a href="mailto:[email protected]">[email protected]</a><br />
<br />
<a href="search_result.aspx?keyword=<%# Eval("building") %>">Search other units in this building</a></span></td>
</tr>
</table>
<p> </p></td>
<td width="210" valign="top"><p class="property"><strong>High-rise apartments<br />HK$<%# Eval("rental", "{0:0,0}")%>
<asp:Label ID="Label1" runat="server" Text="inclusive per month" Visible='<%# (bool)(Eval("mgmt").ToString()=="999999") %>'></asp:Label></strong></p>
<p class="property"><strong>Layout</strong><br />
Size: <%# Eval("area", "{0:0,0}")%> sq ft<br />
<%# Eval("bedrooms") %> Bedroom<br />
<%# Eval("bathrooms") %> Bathroom</p>
<p class="property"><strong>Property Description</strong><br />
<%# Eval("property_desc") %></p> <p class="property"><strong>Facilities </strong>
<%# Eval("fac1") %>
<%# Eval("fac2") %>
<%# Eval("fac3") %></p>
<p class="property"><strong>Enquire about this property</strong><br />
Residential Leasing Department<br />
852-2822-6800<br />
<span class="propertyblue"> <a href="mailto:[email protected]">[email protected]</a></SPAN></p> <p class="contenttextbold"> </p>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView> keyword.Attributes.Add("onfocus", "this.value=''");
DBFun db = new DBFun();
string sql = "";
if (!string.IsNullOrEmpty(Request.QueryString["b"]))
{
sql = "select top 1 b.mgmt,a.building,a.add1 + ','+a.add2 as addr,b.rental,b.area,b.bedrooms,b.bathrooms,"
+ "isnull(b.rem8,'')+isnull(b.rem9,'')+isnull(b.rem10,'')+isnull(b.rem11,'')+isnull(b.rem12,'')+isnull(b.rem13,'')+isnull(b.rem14,'')+isnull(b.rem15,'')+isnull(b.rem16,'')+isnull(b.rem17,'') as property_desc,"
+ "isnull(a.rem1,'')+isnull(a.rem2,'')+isnull(a.rem3,'')+isnull(a.rem4,'')+isnull(a.rem5,'')+isnull(a.rem6,'')+isnull(a.rem7,'')+isnull(a.rem8,'')+isnull(a.rem9,'') as location_desc,"
+ "case isnull(a.fac1,'') when '' then '' else '<br />• '+a.fac1 end as fac1, "
+ "case isnull(a.fac2,'') when '' then '' else '<br />• '+a.fac2 end as fac2, "
+ "case isnull(a.fac3,'') when '' then '' else '<br />• '+a.fac3 end as fac3 from building a,lease b where a.building=b.building and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and b.ref=" + Request.QueryString["r"];
DataSet ds = db.GetDataSetSql(sql);
FormView1.DataSource = ds;
FormView1.DataBind();
ds.Clear(); //sql = "select a.sysid,b.photo_name,a.building,a.ref from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "'";
sql = " select a.sysid,a.building,a.ref,p_id from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and a.ref=" + Request.QueryString["r"] + " union all select a.sysid,a.building,'0',p_id from building a,building_photo b where a.sysid=b.building_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' order by ref";
TextBox1.Text = sql;
DataTable dt1 = db.GetDataTable(sql);
FormView fv2 = (FormView)FormView1.FindControl("FormView2"); fv2.DataSource = dt1;
fv2.DataBind();
dt1.Clear();
DataTable dt=db.GetDataTable(sql);
DataList datalist1=(DataList)FormView1.FindControl("DataList1");
if (datalist1 !=null)
{
datalist1.DataSource = dt;
datalist1.DataBind();
}
dt.Clear();
DBFun db = new DBFun();
string sql = "";
if (!string.IsNullOrEmpty(Request.QueryString["b"]))
{
sql = "select top 1 b.mgmt,a.building,a.add1 + ','+a.add2 as addr,b.rental,b.area,b.bedrooms,b.bathrooms,"
+ "isnull(b.rem8,'')+isnull(b.rem9,'')+isnull(b.rem10,'')+isnull(b.rem11,'')+isnull(b.rem12,'')+isnull(b.rem13,'')+isnull(b.rem14,'')+isnull(b.rem15,'')+isnull(b.rem16,'')+isnull(b.rem17,'') as property_desc,"
+ "isnull(a.rem1,'')+isnull(a.rem2,'')+isnull(a.rem3,'')+isnull(a.rem4,'')+isnull(a.rem5,'')+isnull(a.rem6,'')+isnull(a.rem7,'')+isnull(a.rem8,'')+isnull(a.rem9,'') as location_desc,"
+ "case isnull(a.fac1,'') when '' then '' else '<br />• '+a.fac1 end as fac1, "
+ "case isnull(a.fac2,'') when '' then '' else '<br />• '+a.fac2 end as fac2, "
+ "case isnull(a.fac3,'') when '' then '' else '<br />• '+a.fac3 end as fac3 from building a,lease b where a.building=b.building and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and b.ref=" + Request.QueryString["r"];
DataSet ds = db.GetDataSetSql(sql);
FormView1.DataSource = ds;
FormView1.DataBind();
ds.Clear(); //sql = "select a.sysid,b.photo_name,a.building,a.ref from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "'";
sql = " select a.sysid,a.building,a.ref,p_id from lease a,lease_photo b where a.sysid=b.lease_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' and a.ref=" + Request.QueryString["r"] + " union all select a.sysid,a.building,'0',p_id from building a,building_photo b where a.sysid=b.building_sysid and a.building='" + Request.QueryString["b"].Replace("'", "''") + "' order by ref";
TextBox1.Text = sql;
DataTable dt1 = db.GetDataTable(sql);
FormView fv2 = (FormView)FormView1.FindControl("FormView2"); fv2.DataSource = dt1;//这行出错..
//System.NullReferenceException: 並未將物件參考設定為物件的執行個體 fv2.DataBind();
dt1.Clear();
DataTable dt=db.GetDataTable(sql);
DataList datalist1=(DataList)FormView1.FindControl("DataList1");
if (datalist1 !=null)
{
datalist1.DataSource = dt;
datalist1.DataBind();
}
dt.Clear();
搞不明白怎么回事..请教了