gridview中显示数据库中经转换的数据

前台代码
<asp:TemplateField HeaderText="性别">
     <ItemTemplate>
         <input id="HiddvSID" type="hidden" runat="server" value='<%# Eval("SID") %>' />
         <asp:Label ID="LbevSexName" runat="server" ></asp:Label>
     </ItemTemplate>
</asp:TemplateField>

后台代码
Label sexName= (Label)row.FindControl("LbevSexName");
HiddenField hiddvSID= (HiddenField)row.FindControl("HiddvSID");
if(hiddvSID==0)
{
    sexName = "男";
}
else
{
    sexName = "女";
}

你可能感兴趣的:(java)