repeater with condition

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 %>
 
R

Riki

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...
 
A

Agnes

Thanks Riki, but there is an error about "option strict on"
I already set option strict off. but still got error
 
R

Riki

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

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top