473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

repeater with condition

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

Nov 5 '06 #1
3 3419
"Agnes" <ag***@dynamictech.com.hkwrote in message
news:Ov**************@TK2MSFTNGP03.phx.gbl...
>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 <tdtag 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...

--

Riki
Nov 5 '06 #2
Thanks Riki, but there is an error about "option strict on"
I already set option strict off. but still got error

"Riki" <ri**@dontnagme.com¼¶¼g©ó¶l¥ó·s»D:um************** @TK2MSFTNGP03.phx.gbl...
"Agnes" <ag***@dynamictech.com.hkwrote in message
news:Ov**************@TK2MSFTNGP03.phx.gbl...
>>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 <tdtag 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...

--

Riki


Nov 5 '06 #3
Agnes wrote:
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".............">
</FORM></td>
>
"Riki" <ri**@dontnagme.com>
¼¶¼g©ó¶l¥ó·s»D:um**************@TK2MSFTNGP03.phx.g bl...
>"Agnes" <ag***@dynamictech.com.hkwrote in message
news:Ov**************@TK2MSFTNGP03.phx.gbl...
>>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 <tdtag 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...

--

Riki
--
Riki
Nov 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cédric | last post by:
Hi, Is there any easy way to have a condition in a repeater? I would like to do something like this (of course this does not work): <asp:Repeater id="rpt" runat="Server"> <ItemTemplate>...
3
by: Oleg | last post by:
I am using asp:repeater control. I would like to create a conditional row <tr> when the data in DataBinder.Eval(Container.DataItem, "Activity") returns '1'. I need something like this: <%if(...
3
by: francois | last post by:
Hi, I have a little problem I am using a stored procedure to retrieve my date. What I want to achieve is to be able to "skip" some row from the resultset i retrieve back from the stored...
4
by: Bernie V | last post by:
Hi group, Is it possible to use a condition in a repeater control ? I 'd like to use a condition to create this <a href='<%#DataBinder.Eval(Container.DataItem,"nieuwsid")%>.aspx'> part of the...
1
by: MattB | last post by:
OK, never mind my last post. It was easy enough to refer to the table the repeater is bound to, but I made a big, incorrect assumption in that post. In my last post I thought I was successfully...
6
by: Christoph Boget | last post by:
Could someone point me to a resource that discusses how to set up other controls (input box, checkbox, drop down list), etc to be used in a Repeater? I'm not having a problem displaying text in...
3
by: sorCrer | last post by:
Hi All, Posted after extensive searching! I have a nested repeater control as follows: (Simplified ;-)) <table> <asp:repeater id=parent onItemDataBound=createChild> <tr><td>Level...
1
by: laurence chang | last post by:
I'm using a repeater to display a query result from sql table. I bind the repeater to a sqldatareader. I set repeater's template to a table. I can display query result very well, but some time the...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
4
by: Michael | last post by:
I have a repeater web control. Currently I want to change some row's color based on defined condition. Is there any code sample demonstrating how to accomplish it? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.