且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在网格视图中搜索错误

更新时间:2023-10-19 17:55:46

错误清楚地表明您没有绑定性别名称属性。检查您的DAL是否也提取了GenderName属性
The error clearly shows that you have no gender name property bound . Check whether your DAL fetches you the GenderName property too


请检查您的DataSource genderNams是否可用。如果没有,那么你不能在gridview中使用它进行数据绑定。进一步如果你想代表性别ID显示genderName,那么我有一个你可以轻松使用的解决方案:

< asp:label Id =lblProfilerunat =serverText ='<%#(Convert.ToString(Eval(genderId))== 1?男:女)%>'>



表示genderId是1然后lable lblProfile显示男性其他女性
please check that in your DataSource genderNams available or not. If not then you can't use this for databinding in gridview. further if you want to display genderName on behalf of gender id then i have a solution for you which you can use easily as :
<asp:label Id="lblProfile" runat="server" Text='<%#(Convert.ToString(Eval("genderId"))==1?Male:Female) %>'>

means if genderId is 1 then lable lblProfile shows Male else Female