Hi,
I tried some code for your requirement check this once
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script language ="javascript" >
function f1(tid) {
document.getElementById("residv").innerHTML = tid;
document.getElementById("residv").style.display = '';
return false;
}
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<asp:datalist id="DataList1" runat="server" xmlns:asp="#unknown">
onitemcommand="DataList1_ItemCommand"
onitemdatabound="DataList1_ItemDataBound" >
<HeaderTemplate > <table>
</HeaderTemplate>
<itemtemplate>
<tr>
<td>
</td>
<td>
<asp:linkbutton id="LinkButton1" runat="server" commandname="save" commandargument="2">save</asp:linkbutton>
</td>
</tr>
</itemtemplate>
<footertemplate>
</footertemplate></table>
</asp:datalist>
<div id="residv" style=" position:fixed; bottom :0px; right :0px; display :none; color:Red ;"></div>
</div>
</form>
</body>
</html>
And code behind file contains following code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<string> g = new List<string>();
g.Add("hjghj");
g.Add("hjghj");
g.Add("hjghj");
g.Add("hjghj");
g.Add("hjghj");
g.Add("hjghj");
g.Add("hjghj");
DataList1.DataSource = g;
DataList1.DataBind();
}
}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "save")
{
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lblqid = (LinkButton)e.Item.FindControl("LinkButton1");
string str="data retrieved from database "+e.Item.ItemIndex ;
lblqid.OnClientClick = "return f1('"+str +"')";
}
}
</string></string>
In the above code you can retrieve data from database based on that item
If you use Jquery it is very simple than this
I hope you understood what I did,you get idea on what you can do for your requirement
All the Best.