I think I worded the question wrongly.
I can't use the SQL version because as Mike says I don't want to exclude the
row.
I don't have a problem showing the record when there is no data in one of
the fields.
Sorry this is my mistake but this is more of an ASP question than a datagrid
question.
The users can switch to a table view where there is one record per page in a
tabluar form build using the databinding but using template columns to show
the data in an asp table form. One row may be added like this in the asp for
example
<tr>
<td>Comment:</td>
<td><%# Databinder.Eval(Container.DataItem,"comment") %></td>
</tr>
what I would like to do is only add these individual rows where there is a
value in the field so in this case (although I would wrap all rows this way)
in pseudo code it would be
IF <%# Databinder.Eval(Container.DataItem,"comment") %= "" then
DO nothing / move to next row...
ELSE
<tr>
<td>Comment:</td>
<td><%# Databinder.Eval(Container.DataItem,"comment") %></td>
</tr>
END IF
Cheers,
Ben.
"Mike" wrote:
that would work but i think he still wants to show the row even if there is
no data for all the columns
at least from what I get from this, thats what he's trying to do.
"So if it were Name, Address, Phone. I would show these records where they
are filled out but only name and phone on the specific records where the
address is blank."
"David Wier" <da*******@davidwier.nospam.comwrote in message
news:Oo**************@TK2MSFTNGP03.phx.gbl...
The easiest way is to have your sql statement take care of it
Select * from (table) where (fieldname) is not null
David Wier
http://iWritePro.com
http://aspnet101.com
"Ben." <Be*@discussions.microsoft.comwrote in message
news:61**********************************@microsof t.com...
Hi,
I'm more of a windows programmer than ASP and I've having a little
difficulty in ASP.Net (framework 2.0) - VB.net
I have a datagrid on an aspx page and the html is building the display in
a
table row by row. A sample row being
<tr>
<td>Comment:</td>
<td><%# Databinder.Eval(Container.DataItem,"comment") %></td>
</tr>
I want to only write these rows where there is data. I think I need to
mix
the asp <% and databound <%# elements in some way but maybe this is not
going
to be possible ?
I tried to kick off by at least trying to blank out the label in the
following way (slightly desperate but I felt it might be a step in the
right
direction!) but this doesn't work although I can't see why not
<%# DataBinder.Eval(Container.DataItem, "Comment").Equals("") &
"":"Comment"
%>
VS is telling me a bracket is expected and thate there are 2 additional
unspecified syntax errors in this one line !
Thanks for any help on this!
Ben.