c#(asp.net)几个不同从前台页面操作后台
第一种
<%=RetInfo("DB","数据库") %>
<%=RetInfo("YX_UpFile","上传文件") %>
<%=RetfileInfo("Include/", "广告")%>
//从前台调用后台方法
//从前台调用后台的方法..并向其方法传入不同的参数!
第二种
<ItemTemplate >
<%#Ret_stat(Convert.ToInt16(Eval("YX_Stat1")), "热点")%>
<%#Ret_stat(Convert.ToInt16(Eval("YX_Stat2")), "置顶")%> <%#Ret_stat(Convert.ToInt16(Eval("YX_Stat3")), "推荐")%>
<%#Ret_stat(Convert.ToInt16(Eval("YX_NewsSH")), "审核")%>
</ItemTemplate>这样的一种显示向后台传值更改信息//和第一种相似
第三种
<asp:TemplateColumn HeaderText="操 作">
<ItemTemplate >
<a href="?YX_FS=Edit&YX_MID=<%#Eval("YX_ID")%>">修改</a>
<a href="?YX_FS=Del&YX_MID=<%#Eval("YX_ID")%>">删除</a>
</ItemTemplate>
<HeaderStyle CssClass="style3" />
</asp:TemplateColumn> 从前台同一页面连接并传值
第四种
<%# Eval("YX_TitleHelp")%>//邦定
<%# Stat(Convert.ToInt16(Eval("YX_ID")), Convert.ToInt16(Eval("YX_LyHF")))%>//前台页面调用后
台方法并给它传值
一个很好的列子...
<%
if (Session["userid"] == null)
{%>
<TABLE cellSpacing=0 cellPadding=0 width="62%" border=0>
<TBODY>
<TR>
<TD ><IMG height=27 alt=""
src="<%=Application["http"] %>images/banner_06.jpg" width=208></TD></TR>
<TR>
<TD background=<%=Application["http"] %>images/banner_12.jpg height=77 >
<TABLE class=font1 height=89 cellSpacing=0 cellPadding=1
width=170 align=center border=0>
<TBODY>
<TR>
<TD noWrap align=right width=18 style="height: 37px"><IMG height=13
src="<%=Application["http"] %>images/t_2.gif" width=13 ></TD>
<TD class=p9black noWrap align="center">用户名:</TD>
<TD>
<asp:TextBox ID="Yx_vipName" runat="server" CssClass="txt"></asp:TextBox>
</TD>
<TD vAlign=center align=middle
rowSpan=2> </TD></TR>
<TR>
<TD noWrap align=right><IMG height=13
src="<%=Application["http"] %>images/t_2.gif" width=13 ></TD>
<TD class=p9black noWrap align=Center style=" width: 59px;">密 码:</TD>
<TD style=" width: 97px;">
<asp:TextBox ID="Yx_vipPassword" runat="server" TextMode="Password" CssClass="txt"></asp:TextBox>
</TD></TR>
<TR align=middle>
<TD colSpan=4 height=23>
<asp:ImageButton ID="ImageButton5" ImageUrl="~/images/login2.gif" runat="server" OnClick="ImageButton5_Click" />
<A href="<%=Application["http"] %>VipUser/VipReg.aspx"><IMG
height=19 src="images/login1.gif" width=41
border=0></A> <A
href="<%=Application["http"] %>VipUser/Yx_FindPass.aspx"><IMG
height=19 src="<%=Application["http"] %>images/fg.gif" width=73
border=0></A> </TD></TR></TBODY></TABLE>
</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Yx_vipName"
Display="None" ErrorMessage="请输入用户名!"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Yx_vipPassword"
Display="None" ErrorMessage="请输入密码!"></asp:RequiredFieldValidator>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph"
ShowMessageBox="True" ShowSummary="False" />
</TD></TR>
<TR>
<TD><IMG height=14 alt=""
src="<%=Application["http"] %>images/banner_18.jpg"
width=208></TD></TR></TBODY></TABLE>
<%
}
else
{
%>
<TABLE cellSpacing=0 cellPadding=0 width="62%" border=0>
<TBODY>
<TR>
<TD background=<%=Application["http"] %>images/banner_12.jpg height=77 >
<table border="0" cellpadding="0" cellspacing="0" background="<%=Application["http"] %>background=images/banner_12.jpg" style="width: 94%" >
<tr>
<td style="width: 28px"> </td>
<td style="width: 157px"> </td>
</tr>
<tr>
<td align="center" colspan="2">
<img height="27" alt=""
src="<%=Application["http"] %>images/banner_06.jpg" width="208" /> </td>
</tr>
<tr><td style="height:5px;" colspan="2"></td></tr>
<tr>
<td align="right" style="width: 28px">
<img src="<%=Application["http"] %>images/user.gif" /></td>
<td align="left" style="width: 157px" >
用户名:<asp:Label ID="username" runat="server" ></asp:Label></td>
</tr>
<tr>
<td align="right" style="width: 28px; height: 19px">
<img alt="" src="<%=Application["http"] %>images/vip.gif" /> </td>
<td align="left" style="width: 157px; height: 19px">
会员等级:注册会员</td>
</tr>
<tr>
<td align="right" style="width: 28px; height: 19px"> <img src="<%=Application["http"] %>images/06baihuo_daohang_11.gif"> </td>
<td align="left" style=" height: 19px; width: 157px;">
我的购物车:<asp:Label ID="MyCar" runat="server" Text="还没有订购"></asp:Label></td>
</tr>
<tr>
<td align="right" style="width: 28px; height: 19px">
<img alt="" src="<%=Application["http"] %>images/icon2.gif" /></td>
<td align="left" style=" height: 19px; width: 157px;">
<asp:LinkButton ID="vipcenter" runat="server" OnClick="vipcenter_Click">会员中心</asp:LinkButton></td>
</tr>
<tr>
<td align="center" style="width: 28px; height: 19px"> </td>
<td align="left" style=" height: 19px; width: 157px;">
<asp:LinkButton ID="vipout" runat="server" OnClick="vipout_Click">退出登录</asp:LinkButton></td>
</tr>
<tr>
<td colspan="2" align="center" style="width: 28px;"><img height="14" alt=""
src="<%=Application["http"] %>images/banner_18.jpg"
width="208" /></td>
</tr>
</table>
</TD></TR>
</TBODY></TABLE>
<%} %>
第四种:
<%=tel %> 这样调用后台的变量值
后台:
public string tel="";