我在一个datelist里面读取相应的信息 <asp:DataList ID="MenHomePhoneDataList" runat="server" RepeatColumns="1" RepeatDirection="Horizontal">
<ItemTemplate>
<dl>
<dt>
<table>
<tr>
<td>
<a href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>">
<img src="../<%#Eval("fm") %>" onload="javascript:DrawImage(this,130,146)" alt="lovegw" /></a>
</td>
</tr>
</table>
</dt>
<%-- <asp:Label ID="OppidLabel" runat="server" Text='<%#Eval("hyid") %>'></asp:Label>--%>
<dd>
Name:<%# Eval ("pet_name") %> Age:<%# Eval ("age") %> Country:<%# Country(Eval ("hyid"))%>
</dd>
<dd>
Sex:<%# Sex (Eval ("hyid"))%> Height:<%# Height(Eval("hyid"))%>
Weight:<%# weight(Eval("hyid"))%> Degree:<%# degree(Eval("hyid"))%>
Job:<%# Faith(Eval("hyid"))%>
</dd>
<dd>
<%# Eval ("self") %></dd>
<%if (Session["hyid"] != null)
{%>
<dd>
<label>
<input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick="greettanchushow()" /></label>
<label>
<input type="button" value="Favorites" style="background: url(../images/photo006.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MyHome/AddOrdinaryfriend.aspx?oppid=<%#Eval("hyid")%>&pet_name=<%#Eval("pet_name")%>"' /></label>
<label>
<input type="button" value="Email" style="background: url(../images/photo003.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="Mail/Write_Mail.aspx?type=xie&sjHyId=<%#Eval("hyid") %>"' /></label>
<label>
<input name="button" type="button" style="background: url(../images/photo005.gif) no-repeat;
width: 86px; height: 30px;" value="Details" onclick='location.href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>"' /></label>
</dd>
<%}
else
{%>
<dd>
<label>
<input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input type="button" value="Favorites" style="background: url(../images/photo006.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input type="button" value="Email" style="background: url(../images/photo003.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input name="button" type="button" style="background: url(../images/photo005.gif) no-repeat;
width: 86px; height: 30px;" value="Details" onclick='location.href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>"' /></label>
</dd>
<%} %>
</dl>
</ItemTemplate>
</asp:DataList>
input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick="greettanchushow()" />
<这个按钮onclick="greettanchushow()"的这个事件是弹出一个窗体,在同时我想获取到相应人的ID。本人想过两个方法:
一,写一个标签把值存到标签里,在后台读取出来。
<asp:Label ID="OppidLabel" runat="server" Text='<%#Eval("hyid") %>'></asp:Label>
这样的话,在后台读取需要循环,获取到的ID同时也不是点击相应人的ID。
二,onclick='greettanchushow(<%#Eval("hyid") %>)'在这里传值,这个方法我写了个JS。想传过去,在JS里面保存到Session里面。但是js没有Session属性.请问如何在点击onclick="greettanchushow()"同时获取相应人的ID。如有表述不详细的地方。请讲...
<ItemTemplate>
<dl>
<dt>
<table>
<tr>
<td>
<a href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>">
<img src="../<%#Eval("fm") %>" onload="javascript:DrawImage(this,130,146)" alt="lovegw" /></a>
</td>
</tr>
</table>
</dt>
<%-- <asp:Label ID="OppidLabel" runat="server" Text='<%#Eval("hyid") %>'></asp:Label>--%>
<dd>
Name:<%# Eval ("pet_name") %> Age:<%# Eval ("age") %> Country:<%# Country(Eval ("hyid"))%>
</dd>
<dd>
Sex:<%# Sex (Eval ("hyid"))%> Height:<%# Height(Eval("hyid"))%>
Weight:<%# weight(Eval("hyid"))%> Degree:<%# degree(Eval("hyid"))%>
Job:<%# Faith(Eval("hyid"))%>
</dd>
<dd>
<%# Eval ("self") %></dd>
<%if (Session["hyid"] != null)
{%>
<dd>
<label>
<input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick="greettanchushow()" /></label>
<label>
<input type="button" value="Favorites" style="background: url(../images/photo006.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MyHome/AddOrdinaryfriend.aspx?oppid=<%#Eval("hyid")%>&pet_name=<%#Eval("pet_name")%>"' /></label>
<label>
<input type="button" value="Email" style="background: url(../images/photo003.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="Mail/Write_Mail.aspx?type=xie&sjHyId=<%#Eval("hyid") %>"' /></label>
<label>
<input name="button" type="button" style="background: url(../images/photo005.gif) no-repeat;
width: 86px; height: 30px;" value="Details" onclick='location.href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>"' /></label>
</dd>
<%}
else
{%>
<dd>
<label>
<input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input type="button" value="Favorites" style="background: url(../images/photo006.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input type="button" value="Email" style="background: url(../images/photo003.gif) no-repeat;
width: 86px; height: 30px;" onclick='location.href="MemberAgainLogin.aspx"' /></label>
<label>
<input name="button" type="button" style="background: url(../images/photo005.gif) no-repeat;
width: 86px; height: 30px;" value="Details" onclick='location.href="FriendHomePage/FriendBasicInfo.aspx?hyid=<%#Eval("hyid") %>"' /></label>
</dd>
<%} %>
</dl>
</ItemTemplate>
</asp:DataList>
input type="button" value="Greet" style="background: url(../images/photo004.gif) no-repeat;
width: 86px; height: 30px;" onclick="greettanchushow()" />
<这个按钮onclick="greettanchushow()"的这个事件是弹出一个窗体,在同时我想获取到相应人的ID。本人想过两个方法:
一,写一个标签把值存到标签里,在后台读取出来。
<asp:Label ID="OppidLabel" runat="server" Text='<%#Eval("hyid") %>'></asp:Label>
这样的话,在后台读取需要循环,获取到的ID同时也不是点击相应人的ID。
二,onclick='greettanchushow(<%#Eval("hyid") %>)'在这里传值,这个方法我写了个JS。想传过去,在JS里面保存到Session里面。但是js没有Session属性.请问如何在点击onclick="greettanchushow()"同时获取相应人的ID。如有表述不详细的地方。请讲...
e.Row.DataItem as 实体类;
e.Row.DataItem as DataRow;
2. 没看明白
e代表的事件参数
datalist读取的,不只一个人。这个跟按钮没有任何关联。