Is it posible to do checks within a asp:Repeater loop

A

AAaron123

Is it posible to do checks within a asp:Repeater loop.

In the code that follows I like to write a blank line

instead of:

<%#Eval("Name")%>

- <%#CType(Eval("LastWriteTimeUtc"), DateTime).ToString("u")%>

- <%#Eval("Directory")%>





when <%#Eval("Name")%> returns "ZZ".

Can you tell me how to do that?



Thanks







...snip..

<table style="border-collapse: collapse; border: 2 yellow solid">

<thead>

<tr>

<td>

Name - LastWriteTime - Path

</td>

</tr>

</thead>

<asp:Repeater ID="RepeaterFilesSelected" runat="server">

<ItemTemplate>

<tbody>

<tr>

<td>

<%#Eval("Name")%>

- <%#CType(Eval("LastWriteTimeUtc"), DateTime).ToString("u")%>

- <%#Eval("Directory")%>

</td>

</tr>

</tbody>

</ItemTemplate>

</asp:Repeater>

</table>
 
G

Gregory A. Beamer

Is it posible to do checks within a asp:Repeater loop.

In the code that follows I like to write a blank line

instead of:

<%#Eval("Name")%>

- <%#CType(Eval("LastWriteTimeUtc"), DateTime).ToString("u")%>

- <%#Eval("Directory")%>





when <%#Eval("Name")%> returns "ZZ".

Can you tell me how to do that?

You can do a certain amount of intermingling of code, but I would
consider looking at the row binding event handler and doing the work
there rather than trying to kludge up the tagged page.

http://snurl.com/sf2t0

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
A

AAaron123

Gregory said:
You can do a certain amount of intermingling of code, but I would
consider looking at the row binding event handler and doing the work
there rather than trying to kludge up the tagged page.

http://snurl.com/sf2t0

Peace and Grace,



*******************************************
*******************************************

Not sure what "row binding event handler" means.

If you mean where I do:
RepeaterFilesFound.DataSource = someFiles

RepeaterFilesFound.DataBind()

The problem is that someFiles type is FileInfo()

In te code behind I need to store a FileInfo into someFiles to tell the
markup to add a blank line.

And something in the markup to sense and respond to that FileInfo.

Thanks
 
G

Gregory A. Beamer

Not sure what "row binding event handler" means.

Did you look at the link?
http://snurl.com/sf2t0

That is the event to set up in your code to watch as an item (row) binds
to the Repeater. You can then query the information and alter the output
as needed.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
A

AAaron123

Gregory said:
Did you look at the link?
http://snurl.com/sf2t0

That is the event to set up in your code to watch as an item (row)
binds to the Repeater. You can then query the information and alter
the output as needed.

Peace and Grace,


*******************************************
*******************************************

No I didn't.

Don't know why I didn't notice it.

Maybe I thought it was part of the signature.

Anyway, I check it out right now!


Thanks
 
A

AAaron123

Gregory said:
Did you look at the link?
http://snurl.com/sf2t0

That is the event to set up in your code to watch as an item (row)
binds to the Repeater. You can then query the information and alter
the output as needed.

Peace and Grace,


*******************************************
*******************************************

Exactly what I needed.

Thanks
 

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

Top