9

Unable to create an object of type 'System.Boolean'

 3 years ago
source link: https://www.codesd.com/item/unable-to-create-an-object-of-type-system-boolean.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Unable to create an object of type 'System.Boolean'

advertisements

I am trying to hide the imageButton and embed based on the data coming dfrom Database for that using the following code:

<embed src='<%# Eval("FilePath") %>
 type="application/x-shockwave-flash"
 allowscriptaccess="always" allowfullscreen="true"
 width="150" height="150" runat="server"
 Visible='<%= Eval("UploadType") == "V") %>'></embed>
<asp:ImageButton ID="ibtnHolder" runat="server" Width="130"
 Height="130" ImageUrl='<%# Eval("FilePath") %>'
 Visible='<%= Eval("UploadType") != "V") %>' />

But when i run the above code it gives Error

Cannot create an object of type 'System.Boolean' from its string representation '<%= Eval("UploadType") == "V") %>' for the 'Visible' property.

Can any one suggest how can i resolve


<asp:ImageButton ID="ibtnHolder" runat="server" Width="130"
 Visible='<%# IsVisible(Eval("UploadType"))%>'  />

 public bool IsVisible(object value)
 {
    if (value == "V")
       {
          return true;
       }
        return false;
 }


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK