IT Community - Software Programming, Web Development and Technical Support

How to remove empty or null rows from a dataview

This is a discussion on How to remove empty or null rows from a dataview within the C# Programming forums, part of the Software Development category; When I try to remove the row that coming back empty or null it removes all the data for that ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-10-2008, 07:25 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Default How to remove empty or null rows from a dataview

When I try to remove the row that coming back empty or null it removes all the data for that segment and not just the row.

DataSet myDataSet = new DataSet();DataView myDataView = new DataView();

myDataSet = db.ExecuteDataSet(command);

myDataView = myDataSet.Tables[0].DefaultView;
foreach (DataRow dr in myDataView.Table.Rows)

{
if (dr.IsNull("certifications"))

dr.Delete();

}


return myDataView;

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

<ItemTemplate>

<table cellpadding="10">

<tr>

<td align="left" width="10%" valign="middle">
<asp:HyperLink ID="Image9" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "resume_link") %>' ImageUrl='<%# DataBinder.Eval(Container.DataItem, "image_link") %>' runat="server" /></td>

<td align="left" width="100%" valign="middle">

<asp:Label ID="lblformal_name" CssClass="KPMainTeam" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "formal_name") %>'></asp:Label><br />

<asp:Label ID="lblcertifications" CssClass="KPMainTeam" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "certifications") %>'></asp:Label><br />

<asp:Label ID="lbltiltle" CssClass="KPMainTeam" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "title") %>'></asp:Label></td>

</tr>

</table>

</ItemTemplate>

</asp:Repeater>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-10-2008, 07:29 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: How to remove empty or null rows from a dataview

Hi Wily....

What do you mean it removes the segment? What segment are you referring to?
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-10-2008, 07:34 AM
it.wily it.wily is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
it.wily is on a distinguished road
Default Re: How to remove empty or null rows from a dataview

DataSet myDataSet = new DataSet();
DataView myDataView;
myDataSet = db.ExecuteDataSet(command);

myDataView = myDataSet.Tables[0].DefaultView;

//apply a row filter
myDataView.RowFilter = "not (certifications is null)";
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Dataview to Datatable it.wily C# Programming 2 01-23-2008 02:51 AM
What is the result of comparing NULL with NULL? vijayanand Database Support 1 09-20-2007 07:07 AM
NULL Pointer and a NULL Macro vigneshgets C and C++ Programming 3 09-08-2007 03:24 AM
Empty a recycle bin in C# garunprasad C# Programming 2 08-25-2007 02:56 AM
what is the Difference between isset() and empty() . raj PHP Programming 2 07-19-2007 01:03 AM


All times are GMT -7. The time now is 08:40 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0