你好我在尝试根据会话对象和数据绑定属性设置列表视图项模板中按钮的可见性
<asp:Button ID="deleteCommentButton" runat="server" Text="Delete Comment"
CssClass="redButton"
ToolTip="<%# Session[1].ToString() %>"
Visible="<%# Session[1].ToString() == Bind("fullname") ? true : false %>"
style="float:right; margin-left:5px; margin-top:-25px;"
onclick="deleteCommentButton_Click" />
但我收到了错误。 。有什么建议吗?
答案 0 :(得分:0)
请试试这个
<asp:Button ID="deleteCommentButton" runat="server" Text="Delete Comment"
CssClass="redButton"
ToolTip='<%# HttpContext.Current.Session[1].ToString() %>'
Visible='<%# HttpContext.Current.Session[1].ToString() == Bind("fullname") ? true : false %>'
style="float:right; margin-left:5px; margin-top:-25px;"
onclick="deleteCommentButton_Click" />