DataList中的ItemTemplate中有一处关于描述的文字(比较多)
要根据行ID到另一张表去读数据
本来是可以在ItemDataBound事件中处理
但是我想通过ajax看能不能提高用户打开网页的速度
也就是先把其它内容下载下来
然后在用ajax去读内容比较多的描述
不知道应该如何实现?
是将整个DataList 放在<asp:UpdatePanel>中吗?
还是在<ItemTemplate>中放置<asp:UpdatePanel>
求教。。
要根据行ID到另一张表去读数据
本来是可以在ItemDataBound事件中处理
但是我想通过ajax看能不能提高用户打开网页的速度
也就是先把其它内容下载下来
然后在用ajax去读内容比较多的描述
不知道应该如何实现?
是将整个DataList 放在<asp:UpdatePanel>中吗?
还是在<ItemTemplate>中放置<asp:UpdatePanel>
求教。。
<style type="text/css">
.transparent {
BORDER-RIGHT: indianred 1px solid;
BORDER-TOP: indianred 1px solid;
DISPLAY: none;
FILTER: alpha(opacity=85);
BORDER-LEFT: indianred 1px solid;
BORDER-BOTTOM: indianred 1px solid;
POSITION: absolute;
BACKGROUND-COLOR: infobackground;
}
</style>
<script language="JavaScript">
function IDResult(intid)
{
AjaxMethod.GetSysContent(intid,get_ZZContent_Result_CallBack);
showDiv('block');
}
function get_ZZContent_Result_CallBack(response)
{
if (response.value != null)
{
var content = document.getElementById('contentDiv');
content.innerHTML=response.value;
}
return
}
function showDiv(show)
{
var div= document.getElementById('processDiv');
x = event.clientX + document.body.scrollLeft;
y = event.clientY + document.body.scrollTop + 20;
div.style.display=show;
div.style.left = x;
div.style.top = y;
}
</script>
<asp:BoundColumn Visible="False" DataField="ID" ReadOnly="True" HeaderText="记录ID">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="编号">
<HeaderStyle HorizontalAlign="Center" Width="25px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<%# (pager.CurrentPageIndex-1)*pager.PageSize+grid.Items.Count+1 %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Title" HeaderText="标题">
<HeaderStyle Width="510px"></HeaderStyle>
</asp:BoundColumn>private void grid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemIndex>=0)
{
string title="#E3EFFF";
string bgcolor="#F5F9FF";
e.Item.Attributes.Add("onMouseOver","this.style.backgroundColor='"+title+"'; this.style.cursor='hand';");
e.Item.Attributes.Add("onMouseOut","this.style.backgroundColor='"+bgcolor+"';");
e.Item.Cells[2].Attributes.Add("onclick", "IDResult('" + e.Item.Cells[0].Text.Trim() + "');");
}
}
<div align="center" style="BACKGROUND-COLOR: indianred"><A onclick="showDiv('none');" href="#"><strong><font color="#ff9900">关闭</font></strong></A></div>
<div id="contentDiv" style="BACKGROUND-COLOR: #00ccff"></div>
</div>