读书人

Repeater 控件收缩展开效果只对第一行

发布时间: 2012-12-27 10:17:09 作者: rapoo

Repeater 控件收缩展开效果只对第一行起效果,怎么解决?在线等
本帖最后由 jiangmurong 于 2011-06-17 13:33:00 编辑


<script type="text/javascript">
var s=5;
var minheight=0;
var maxheight=100;
function shoppingcat(){
var content=document.getElementById("content");
var key = document.getElementById("key");
var t=content.style;
if(t.height==""||t.height==0)
t.height=minheight;
var h=parseInt(t.height);
if(key.innerHTML=="职位描述"){
h+=s;
t.height=h+"px";
if(h<maxheight){
setTimeout("shoppingcat();",1);
}else{
key.innerHTML="关闭";
}
}else{
h-=s;
t.height=h+"px";
if(h>minheight){
setTimeout("shoppingcat();",1);
}else{
key.innerHTML="职位描述";
}
}
}
</script>
<style type="text/css">
#content {
font-size: 14px;
width: 500px;
height: 0px;
background: #fff;
padding: 0px;
border: 1px #fff double;
overflow: hidden;
}
#key {
color: red;
float: right;

}
span{cursor:pointer;}
</style>



<asp:Repeater ID="listjobs" runat="server"><ItemTemplate>
<tr id="5_<%# DataBinder.Eval(Container.DataItem,"company_job_info_id")%>">
<td width="150" height="28" align="center" bgcolor="#FFFFFF"><a target="_blank" href="jobview.aspx?company_job_info_id=<%# Server.UrlEncode(DataBinder.Eval(Container.DataItem,"company_job_info_id"))%>"><%# ctype(Container.DataItem,DataRowView).Row(1) %></a></td>
<td align="center" bgcolor="#FFFFFF" ><a href="com_job_view.aspx?company_user_id=<%# DataBinder.Eval(Container.DataItem,"company_user_id")%>" target="_blank"><%# ctype(Container.DataItem,DataRowView).Row(2) %></a></td>


<td align="center" bgcolor="#FFFFFF"><%#Get_province(ctype(Container.DataItem, DataRowView).Row(3)) %></td>
<td align="center" bgcolor="#FFFFFF" ><%#Common.getdate(ctype(Container.DataItem, DataRowView).Row(4).ToString(), 2)%></td>
<td align="center" bgcolor="#FFFFFF" ><span id="key" title="点击查看职位描述/要求" onclick="shoppingcat();">职位描述</span></td>
</tr>
<tr><td colspan="4"><div id="content">
<strong style="color:#636563; font-size:12px">公司性质:</strong><label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(5) %></label>
<strong style="color:#636563; font-size:12px">公司规模:</strong><label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(6) %> </label>
<strong style="color:#636563; font-size:12px">经验要求:</strong><label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(7) %></label>


<strong style="color:#636563; font-size:12px">最低学历:</strong><label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(8) %></label>
<strong style="color:#636563; font-size:12px">职位月薪:</strong><label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(9) %></label>
<br /><p style="color:#737573; font-size:12px">职位描述及要求:<label style="color:#737573; font-size:12px"><%# ctype(Container.DataItem,DataRowView).Row(10) %>... </label>
</div></td></tr>

</ItemTemplate></asp:Repeater>


[解决办法]
参见
http://dotnet.aspx.cc/article/f73eeaa9-2bdc-47fd-afd2-59f2fa4897f5/read.aspx

http://dotnet.aspx.cc/Exam/GridViewNested2.aspx
[解决办法]
楼上可以。

修改下就能满足你的要求了。

引用:
参见
http://dotnet.aspx.cc/article/f73eeaa9-2bdc-47fd-afd2-59f2fa4897f5/read.aspx

http://dotnet.aspx.cc/Exam/GridViewNested2.aspx

[解决办法]
ID在同页面中只能是唯一的 所以你只有第一个有效。
[解决办法]
拼div/CSS才是硬道理啊 呵呵

读书人网 >C#

热点推荐