Hi micah,
I have created sample refer the below code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id*=btnSelect]").click(function () {
$("#name").html($("[id*=lblName]", $(this).closest("tr")).html());
$("#userName").html($("[id*=lblUserName]", $(this).closest("tr")).html());
$("#friendUserName").html($("[id*=lblFriendUserName]", $(this).closest("tr")).html());
$("#contentPost").html($("[id*=lblContentPost]", $(this).closest("tr")).html());
$("#imageName1").html($("[id*=lblImageName1]", $(this).closest("tr")).html());
$("#imageName2").html($("[id*=lblImageName2]", $(this).closest("tr")).html());
$("#imageName3").html($("[id*=lblImageName3]", $(this).closest("tr")).html());
$("#imageName4").html($("[id*=lblImageName4]", $(this).closest("tr")).html());
$("#dialog").dialog({
title: "View Details",
width: 400,
buttons: {
Ok: function () {
$(this).dialog('close');
}
},
modal: true
});
return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<b>Name:</b> <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label><br />
<b>UserName:</b> <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName") %>'></asp:Label><br />
<b>FriendUserName:</b> <asp:Label ID="lblFriendUserName" runat="server" Text='<%# Eval("FriendUserName") %>'></asp:Label><br />
<b>ContentPost:</b> <asp:Label ID="lblContentPost" runat="server" Text='<%# Eval("ContentPost") %>'></asp:Label><br />
<b>ImageName1:</b> <asp:Label ID="lblImageName1" runat="server" Text='<%# Eval("ImageName1") %>'></asp:Label><br />
<b>ImageName2:</b> <asp:Label ID="lblImageName2" runat="server" Text='<%# Eval("ImageName2") %>'></asp:Label><br />
<b>ImageName3:</b> <asp:Label ID="lblImageName3" runat="server" Text='<%# Eval("ImageName3") %>'></asp:Label><br />
<b>ImageName4:</b> <asp:Label ID="lblImageName4" runat="server" Text='<%# Eval("ImageName4") %>'></asp:Label><br />
<asp:Button ID="btnSelect" runat="server" Text="Select"></asp:Button>
</ItemTemplate>
</asp:DataList>
<div id="dialog" style="display: none">
<b>Name:</b> <span id="name"></span><br />
<b>UserName:</b> <span id="userName"></span><br />
<b>FriendUserName:</b> <span id="friendUserName"></span><br />
<b>ContentPost:</b> <span id="contentPost"></span><br />
<b>ImageName1:</b> <span id="imageName1"></span><br />
<b>ImageName2:</b> <span id="imageName2"></span><br />
<b>ImageName3:</b> <span id="imageName3"></span><br />
<b>ImageName4:</b> <span id="imageName4"></span><br />
</div>
</form>
</body>
</html>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[8]
{
new DataColumn("Name"),
new DataColumn("UserName"),
new DataColumn("FriendUserName"),
new DataColumn("ContentPost"),
new DataColumn("ImageName1"),
new DataColumn("ImageName2"),
new DataColumn("ImageName3"),
new DataColumn("ImageName4")
});
dt.Rows.Add("Name1", "UserName1", "FriendUserName1", "ContentPost1", "ImageName11.jpg", "ImageName21.jpg", "ImageName31.jpg", "ImageName41.jpg");
dt.Rows.Add("Name2", "UserName2", "FriendUserName2", "ContentPost2", "ImageName12.png", "ImageName22.png", "ImageName32.png", "ImageName42.png");
dt.Rows.Add("Nam3", "UserName3", "FriendUserName3", "ContentPost3", "ImageName13.gif", "ImageName23.gif", "ImageName33.gif", "ImageName43.gif");
DataList1.DataSource = dt;
DataList1.DataBind();
}
}
Screenshot