When i have run this query method showuserpost error message show System.Data.DataRowView' does not contain a property with the name 'image_url'.
<asp:DataList ID="Datalistpost" runat="server" Width="560px" BorderWidth="1px"
OnItemCommand="Datalistpost_ItemCommand" RepeatLayout="Table" >
<ItemStyle CssClass="grid1" />
<ItemTemplate>
<table style="width: 546px">
<tr>
<td style="width:50px">
<asp:Image ID="imagepost" runat="server" ImageUrl='<%#Eval("imagedata") %>' CssClass="imag" />
</td>
<td class="style11">
<asp:Label ID="lablepost" runat="server" Text='<%# Eval("post_text") %>' Font-Names="Verdana"
Font-Size="10pt" ForeColor="Black"></asp:Label><br /><br />
<asp:Image ID="im11" runat="server" ImageUrl='<%#Eval("file_path") %>' Width="120px"
Height="120px" /><br />
<video id="VideoPlayer" src='<%#Eval("video_link") %>' runat="server" controls="true"
width="300" height="200" type="video/mp4"></video><br />
<asp:Image ID="IMUSERPHOTO" runat="server" ImageUrl='<%#Eval("image_url") %>' Width="200px" Height="100px" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
public DataSet showuserpost(int uid)
{
Sqlcon();
string qry = "select * from tbluserinfo as p join tbluserprofilepicture t on p.id=t.id"
+ " join post pt on pt.id=p.id"
+ " join tblfrequst tbf on tbf.to_id=p.id"
+ " where tbf.from_id=@id"
+ " UNION "
+ " select * from tbluserinfo as p join tbluserprofilepicture t on p.id=t.id"
+ " join post pt on pt.id=p.id"
+ " join tblfrequst tbf on tbf.from_id=p.id"
+ " where tbf.to_id=@id";
SqlDataAdapter adp = new SqlDataAdapter(qry, con);
adp.SelectCommand.Parameters.Add("@id", SqlDbType.Int, 100).Value = uid;
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
return ds;
}
else
{
return null;
}
}
public DataSet showuserphoto(int uid)
{
Sqlcon();
string qry = "select * from tbluserinfo as p join tbluserprofilepicture t on p.id=t.id"
+ " join CREATE_ALBUM pc on pc.U_ID=p.id"
+ " join ALBUM_PHOTO te on te.al_id=pc.AL_ID"
+ " join tblfrequst tbl on tbl.from_id=p.id"
+ " where tbl.to_id=@id"
+ " UNION"
+ " select * from tbluserinfo as p join tbluserprofilepicture t on p.id=t.id"
+ " join CREATE_ALBUM pc on pc.U_ID=p.id"
+ " join ALBUM_PHOTO te on te.al_id=pc.AL_ID"
+ " join tblfrequst tbl on tbl.to_ID=p.id"
+ " where tbl.from_id=@id order by wl_id desc";
SqlDataAdapter adp = new SqlDataAdapter(qry, con);
adp.SelectCommand.Parameters.Add("@id", SqlDbType.Int, 100).Value = uid;
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
return ds;
}
else
{
return null;
}
}