I have a script for infinie paging data where one of the items i return is an image, not text. Right now I am returning as text. Can someone help me return as the html or asp image? The line I need to fix and can use the logic for other is ==$(".msgpic", table).html(customer.find("MsgPicture").text()); == See code...
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var pageIndex = 1;
var pageCount;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
function GetRecords() {
pageIndex++;
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "WebInfiniteScroll.aspx/GetCustomers",
data: '{pageIndex: ' + pageIndex + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
}
}
function OnSuccess(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var customers = xml.find("aspnet_Message_History");
customers.each(function () {
var customer = $(this);
var table = $("#dvCustomers table").eq(0).clone(true);
$(".msgpic", table).html(customer.find("MsgPicture").text());
$(".pic", table).html(customer.find("Picture").text());
$(".name", table).html(customer.find("UserFullName").text());
$(".msgtype", table).html(customer.find("MsgType").text());
$(".msggrpdesc", table).html(customer.find("MsgGrpDesc").text());
$(".msgdetail", table).html(customer.find("MessageDetail").text());
$(".msgurl", table).html(customer.find("UserFullName").text());
$("#dvCustomers").append(table).append("<br />");
});
$("#loader").hide();
}
</script>
<div id="dvCustomers">
<asp:ListView ID="DataList2" runat="server" EnableViewState="False">
<ItemTemplate>
<table>
<tr>
<td>
<div id="dvPhoto" runat="server" style="clear: both; float: right">
<span class="msgpic"><asp:Image ID="imgMsgPhoto" runat="server" Height="55px" Width="55px" GenerateEmptyAlternateText="true"
ImageAlign="Middle" ImageUrl='<%# Eval("MsgPicture") %>' /></span>
</div>
<span class="pic"><img src="Images/<%# Eval("Picture") %>" alt="Picture" height="45" width="45" /></span>
<span class="name">
<asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserFullName") %>' Font-Bold="True" /></span>
<span class="msgtype"><asp:Label ID="lblMsgType" runat="server" Text='<%# Eval("MsgType") %>' Font-Italic="True"
Font-Size="Smaller" ForeColor="#CCCCCC" /></span>
<span class="msggrpdesc"><asp:Label ID="lblMsgGroupDesc" runat="server" Text='<%# Eval("MsgGroupDesc") %>'
Font-Italic="True" Font-Size="Smaller" ForeColor="#CCCCCC" /></span>
<div style="text-align: justify"><span class="msgdetail">
<asp:Label ID="MessageDetailLabel" runat="server" Text='<%# Eval("MessageDetail") %>'
Font-Size="Smaller" Width="100%" /></span>
<span class="msgurl"><asp:HyperLink ID="hlnkMessageLinkURL" runat="server" NavigateUrl='<%# Eval("MessageURL") %>'
Target="_blank"><%# Eval("MessageURLDesc")%></asp:HyperLink></span>
<br />
<hr />
</div>
<asp:UpdatePanel runat="server" ID="upnlMessages" UpdateMode="Conditional">
<ContentTemplate>
<div style="left: 25px; color: #C0C0C0; font-size: smaller;">
<asp:HyperLink runat="server" ID="MessageId" NavigateUrl='<%#"SBN_Messaging.aspx?MsgId=" + Eval("MessageId") + "&MsgType=" + Eval("MessageType") + "&User=" + Eval("MessageFromId") + "&UserFN=" + Eval("UserFirstName") + "&UserTo=" + Eval("MessageToId") + "&MsgReplyTo=" + Eval("MsgReplyTo") + "&MsgPic=" + Eval("MsgPicture") %>'
Target="SBN_Main" Font-Size="Smaller">Comment</asp:HyperLink>
|
<span class="msgid"></span><asp:LinkButton ID="lbtnEnjoy" runat="server" Font-Size="Smaller" CommandArgument='<%# Eval("MessageId") %>'
OnCommand="SetMessageEnjoy_Click">Enjoy</asp:LinkButton></span>
|
<asp:LinkButton ID="lbtnShare" runat="server" Font-Size="Smaller">Share</asp:LinkButton>
|
<span class="msgid"><asp:LinkButton ID="lbtnDismiss" runat="server" OnCommand="lbtnDismiss_Click" CommandArgument='<%# Eval("MessageId") %>'
Font-Size="Smaller" ViewStateMode="Inherit">Dismiss</asp:LinkButton></span>
|
<%# Eval("Days_Hours_Minutes")%>
</div>
<hr />
<div id="Div1" runat="server" style="font-size: x-small; color: #6699FF">
<%# Eval("EnjoyCNT") %>
Enjoy and
<%# Eval("MessageCNT") %>
Commented on this
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lbtnEnjoy" EventName="click" />
</Triggers>
</asp:UpdatePanel>
</div>
</td>
</tr>
</table>
<hr />
</ItemTemplate>
</asp:ListView>