DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 15 Aug 2007 05:46:19 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Ben.
          2    Mike
                 3    Ben.
                        4    Mike
          5    David Wier
                 6    Mike
                 7    Ben.


controlling databound ASP   
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.
Date:Wed, 15 Aug 2007 05:46:19 -0700   Author:  

Re: controlling databound ASP   
You can do this.

create a dataset for your data
bind your datagrid like this

datagrid.datasource = ds;
datagrid.databind();

that will bind your datagrid.

if you want to only show certain data items then you can specify that by 
going to the properties of the grid and add the columns you want to show.


"Ben."  wrote in message 
news:61CBA052-FAA8-4CAA-A393-205B2C2F0B57@microsoft.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. 
Date:Wed, 15 Aug 2007 09:37:19 -0400   Author:  

Re: controlling databound ASP   
Thanks for replying.  I already have a page that is successfully showing the 
results in the way you have outlined.  The difficulty I have is not in 
disregarding columns but not adding them for the specific records where they 
are blank.

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.

Cheers,

Ben.
Date:Wed, 15 Aug 2007 06:54:04 -0700   Author:  

Re: controlling databound ASP   
if you have a grid, its only going to show the data you have. I have 
something similiar. I have a grid on my page and it shows

name, office, phone number

and even though a name may be blank or office, etc, it still shows the rest 
of the data for that row.
so I may have a grid look like this at times

name               office                    phone number
Greg               Philly                     555-1212
Karen             Orlando
Beth                                             555-1234

and i'm only using the dataset for my grid, I'm not doing anything specail 
for this result.
Unless I'm missing what your saying, your grid should show like above


"Ben."  wrote in message 
news:DDA49875-1806-48D1-B17C-FF29460153C1@microsoft.com...

> Thanks for replying.  I already have a page that is successfully showing 
> the
> results in the way you have outlined.  The difficulty I have is not in
> disregarding columns but not adding them for the specific records where 
> they
> are blank.
>
> 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.
>
> Cheers,
>
> Ben. 
Date:Wed, 15 Aug 2007 10:29:26 -0400   Author:  

Re: controlling databound ASP   
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."  wrote in message 
news:61CBA052-FAA8-4CAA-A393-205B2C2F0B57@microsoft.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. 
Date:Wed, 15 Aug 2007 09:38:12 -0500   Author:  

Re: controlling databound ASP   
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"  wrote in message 
news:OoO2gn03HHA.4880@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."  wrote in message 
> news:61CBA052-FAA8-4CAA-A393-205B2C2F0B57@microsoft.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.
>
> 
Date:Wed, 15 Aug 2007 10:42:58 -0400   Author:  

Re: controlling databound ASP   
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"  wrote in message 
> news:OoO2gn03HHA.4880@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."  wrote in message 
> > news:61CBA052-FAA8-4CAA-A393-205B2C2F0B57@microsoft.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.
> >
> > 
> 
> 
> 
Date:Wed, 15 Aug 2007 08:02:05 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us