repeater with condition

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I use repater to show the data(invoice), the last column (download button)
for the user to download the invoice copy However, if the invoice had been
settled, the download must bet disable or visible to false.
I try to use if ... then statment to do , but it seesm fail.
Please help

<%# If Container.DataItem("paid") = "Y" Then%>
<td><form action="download.aspx" >
<input type="button" value="Download".............">
</FORM></td>
<%end if %>
 
Agnes said:
I use repater to show the data(invoice), the last column (download button)
for the user to download the invoice copy However, if the invoice had been
settled, the download must bet disable or visible to false.
I try to use if ... then statment to do , but it seesm fail.
Please help

<%# If Container.DataItem("paid") = "Y" Then%>
<td><form action="download.aspx" >
<input type="button" value="Download".............">
</FORM></td>
<%end if %>

Change the <td> tag into a server control and bind
the visible property to your dataitem:

<td runat="server" id="mytd"
visible='<%# Container.DataItem("paid") = "Y" %>' >
<form action="download.aspx" >
<input type="button" value="Download".............">
</FORM></td>

However, you're creating a nested form, and I doubt if
that will work in all browsers...
 
Thanks Riki, but there is an error about "option strict on"
I already set option strict off. but still got error
 
Agnes said:
Thanks Riki, but there is an error about "option strict on"
I already set option strict off. but still got error

Then use a cast with ToString():
<td runat="server" id="mytd"
visible='<%# CBool(Container.DataItem("paid").ToString() = "Y") %>' >
<form action="download.aspx" >
<input type="button" value="Download".............">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top