I am working on a real estate website and I am using a datalist (ASP.NET / C#) to show listing, my next step which i can’t figure out how to do it, is if I click on the link ‘edit’, Select information for that specific house and show it in the Edit.aspx and each field of the datalist is shown in a textbox.
My database is pretty easy with just 4 fields : IDhouse, Price, Bedroom, ImgHouse.
Please if someone can help me I will appreciate it so much, thank you.
Code:
<asp:DataList ID="DataList1" runat="server" DataKeyField="IDhouse"
DataSourceID="SqlDataSource1"/>
<ItemStyle ForeColor="#000066" />
<ItemTemplate>
<table>
<tr>
<td class="style2">
Price : <asp:Label ID="Label1" runat="server" Text='<%# Eval("Price", "{0:C}") %>' /><br />
Beds : <asp:Label ID="Label2" runat="server" Text='<%# Eval("Bedroom") %>' /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:HyperLink ID="HyperLink2" runat="server">Delete</asp:HyperLink>
<asp:HyperLink ID="HyperLink1" runat="server">Edite</asp:HyperLink>
</td>
<td class="style1">
<asp:Image ID="Image1" runat="server" Height="201px" Width="331px"
ImageUrl='<%# "~/DisplayImg.ashx?IDhouse="+ Eval("IDhouse") %>'/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
Replace
with
and on the Edit.aspx page, load the required data based on the IDhouse value obtained from the querystring