<%@ import namespace="system.data" %>
<%@ import namespace="system.data.oledb" %>
<%@ Import Namespace="System.Web.Security" %>
<!-- #include virtual="1.inc" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.style1 {font-size: 12px}
.style2 {font-size: 14px}
-->
</style>
</head>
<body>
<form runat="server">
<asp:DataGrid ID="dg1" runat="server" HorizontalAlign="center" DataKeyField="didld" OnItemDataBound="i_amd" AutoGenerateColumns="false" >
<columns>
<asp:BoundColumn HeaderText="didld" DataField="didld" Visible="false"/>
<asp:ButtonColumn Text="展开" ButtonType="LinkButton" />
<asp:TemplateColumn>
<itemtemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="c3.gif">
<span class="style2"><%# Container.DataItem("dzhuti") %> <strong>斑竹:</strong><%# Container.DataItem("dbanzhu") %> </span></td>
</tr>
</table>
</itemtemplate>
<edititemtemplate>
<asp:DataList ID="d1" Width="100%" runat="server" HorizontalAlign="Center" OnUpdateCommand="d1_click" DataKeyField="rid" DataSource='<%# Container.DataItem("ds1") %>'>
<itemtemplate>
<table width="100%" border="1" cellpadding="0" cellspacing="0" vibordercolor="#FF8000">
<tr>
<td width="6%" bgcolor="#FFDAB5"><center><asp:image runat="server" ImageUrl='<%# Container.DataItem("xzhutit") %>'/>
</center></td>
<td width="66%" bgcolor="#FFDAB5" class="style1"><asp:linkbutton ID="h1" Text='<%# Container.DataItem("xiaozhut") %>' runat="server" CommandName="update"/> 点击:<%# Container.DataItem("ci") %> <bR>
<input type="image" src="Forum_readme.gif" width="10" height="10">
<%# Container.DataItem("xcontent") %> <br>
斑竹:<%# Container.DataItem("banzhu") %> 今天:<%# Container.DataItem("jt") %>昨天:<%# Container.DataItem("zt") %></td><td><input type="hidden" id="hi" value="'<%# Container.DataItem("rid") %>'"</td>
<td width="28%" bgcolor="#FFDAB5"><p class="style1">主题:<%# Container.DataItem("xzhuti") %>
<p class="style1">日期 :<%# Container.DataItem("xdate") %> 作者:<%# Container.DataItem("xname") %><br>
点击/回复:<%# Container.DataItem("xci") %>/<%# Container.DataItem("hc") %>
</p></td>
</tr>
</table>
<table width="100%" height="19" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF8000">
<tr>
<td bgcolor="#FFE7CE" class="style1">总点击:<%# Container.DataItem("zci") %>今天:<%# Container.DataItem("zjt") %>昨天:<%# Container.DataItem("zzt") %></td>
</tr>
</table>
</itemtemplate>
<itemstyle BackColor="#CCFF99"/>
</asp:DataList>
</asp:Panel>
<asp:Label ID="l1" runat="server"/>
</edititemtemplate>
</asp:TemplateColumn>
</columns>
</asp:DataGrid>
</form>
</body>
<script language="vb" runat="server">
public shared a as integer
public shared b as string
sub d1_click(sender as object,e as datalistcommandeventargs)
dim sql as string="select * from lda where dg1.datakeyfield=" & b
dim ds as dataset=cds(sql,"lda","luentan.mdb")
dim dt as datatable=ds.tables("lda")
b=session("b")
a=e.item.itemindex+1
dim sql1 as string="select * from lx where id=" & b
dim ds1 as dataset=cds(sql1,"lx","luentan.mdb")
dim d1 as datalist=ctype(e.item.findcontrol("d1"),datalist)
d1.datasource=ds1
d1.databind()
dim c as integer
c=ds1.tables("lx").rows(e.item.itemindex).item("ci")+1
dim obj as new oledbconnection()
obj.connectionstring="Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = "& Server.MapPath ("luentan.mdb")
obj.open()
dim sql22 as string="update lx set ci='" & c & "' where " & d1.datakeyfield & "=" & d1.datakeys(e.item.itemindex)
dim ob as new oledbcommand(sql22,obj)
ob.executenonquery()
obj.close()
session.add("b",b)
session.add("a",a)
response.Redirect("xxiaozhut.aspx?didld=" & b & "&" & "rid=" & a)
end sub
sub page_load
dim sql as string="select * from lda"
dim ds as dataset=cds(sql,"lda","luentan.mdb")
dim dt as datatable=ds.tables("lda")
dim sql1 as string="select * from lx"
dim ds1 as dataset=cds(sql1,"lx","luentan.mdb")
dg1.datasource=ds
dg1.databind()
end sub
sub i_amd(sender as object,e as datagriditemeventargs)
dim sql as string="select * from lda"
dim ds as dataset=cds(sql,"lda","luentan.mdb")
dim dt as datatable=ds.tables("lda")
dim sql1 as string="select * from lx"
dim ds1 as dataset=cds(sql1,"lx","luentan.mdb")
dg1.datasource=ds
b=e.item.cells(0).text
session.add("b",b)
dg1.databind()
dim d1 as datalist=ctype(e.item.findcontrol("d1"),datalist)
d1.datasource=ds1
d1.databind()
end sub
</script>
</html>
在OnItemDataBound事件中是可以帮定第2个DATAGRID的数据源的,页面可以显示,但是点击LINKBUTTON的时候时间很久,最后出来Request timed out,搞拉一个星期都这样,真的很急,在线等答案,请大家帮帮我