I mainly work with GridView. Let me see about that. But you'd add that attribute in each row of the DetailView on the ASP side.
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
This is the error I get when I add that code to a BoundField in Detailsview:
Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.BoundField does not have a DataBinding event.
Try adding emptydatarowstyle visible="False" in the opening tag for the DetailView and get rid of everything else setting visibility.
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
OK, that was dumb. Um, could you post the whole asp for the DetailsView please?
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Charles Asbo...
Contributor
5512 Points
1186 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 06:18 PM|LINK
I mainly work with GridView. Let me see about that. But you'd add that attribute in each row of the DetailView on the ASP side.
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Charles Asbo...
Contributor
5512 Points
1186 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 06:20 PM|LINK
Try
<emptydatarowstyle visible="False"/>
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
sbudlong
Member
65 Points
124 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 06:35 PM|LINK
Good. I'll try this, and your next suggestion, as well.
Thank you very much, Charles. I feel as though I very close to an answer now.
sbudlong
Member
65 Points
124 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 06:41 PM|LINK
When I tried this, I get "Type 'System.Web.UI.WebControls.TableItemStyle' does not have a public property named 'visible'."
I put it here
<asp:BoundField DataField="imgWidth" HeaderText="Width"
SortExpression="imgWidth" />
<asp:BoundField DataField="imgHeight" HeaderText="Height"
SortExpression="imgHeight" />
<asp:BoundField DataField="imgSortOrder" HeaderText="Sort Order"
SortExpression="imgSortOrder" />
<asp:CheckBoxField DataField="imgInclude" HeaderText="Include"
SortExpression="imgInclude" />
</Fields>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
<EditRowStyle BackColor="#999999" />
<emptydatarowstyle visible="False"/>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left"
/>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Left"
/>
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:DetailsView>
sbudlong
Member
65 Points
124 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 06:45 PM|LINK
This is the error I get when I add that code to a BoundField in Detailsview:
Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.BoundField does not have a DataBinding event.
Here is what the code looks like.
<asp:BoundField DataField="imgSortOrder" HeaderText="Sort Order"
SortExpression="imgSortOrder" Visible='<%# !Convert.ToBoolean(Eval("ColumnName")=Null) %>' />
<asp:CheckBoxField DataField="imgInclude" HeaderText="Include"
SortExpression="imgInclude" />
</Fields>
Charles Asbo...
Contributor
5512 Points
1186 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 07:41 PM|LINK
Try adding emptydatarowstyle visible="False" in the opening tag for the DetailView and get rid of everything else setting visibility.
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
sbudlong
Member
65 Points
124 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 08:14 PM|LINK
This makes the whole Detailview hidden.
<asp:DetailsView ID="Products" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1" Height="50px" Width="390px" CellPadding="4" ForeColor="#333333" GridLines="None" emptydatarowstyle visible="False">
Charles Asbo...
Contributor
5512 Points
1186 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 08:26 PM|LINK
OK, that was dumb. Um, could you post the whole asp for the DetailsView please?
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
sbudlong
Member
65 Points
124 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 08:36 PM|LINK
Thank you, Charles. Here is the whole Detailsview.
<asp:DetailsView ID="Products" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1" Height="50px" Width="390px" CellPadding="4" ForeColor="#333333" GridLines="None">
<Fields>
<asp:BoundField DataField="PhotoID" HeaderText="PhotoID"
InsertVisible="False" ReadOnly="True"
SortExpression="PhotoID" />
<asp:BoundField DataField="AlbumID" HeaderText="AlbumID"
SortExpression="AlbumID" />
<asp:TemplateField HeaderText="Thumbnail Image">
<ItemTemplate>
<img src='http://10.0.0.115/ISSmktg/Handler.ashx?Size=S&PhotoID=<%# Eval("PhotoID") %>' class="photo_198" style="border:2px solid white;width:50px;" alt='Thumbnail of Photo Number <%# Eval("PhotoID") %>' /></td>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Caption" HeaderText="Caption"
SortExpression="Caption" />
<asp:BoundField DataField="imgFileName" HeaderText="File Name"
SortExpression="imgFileName" />
<asp:BoundField DataField="imgDescription" HeaderText="Description"
SortExpression="imgDescription" />
<asp:BoundField DataField="imgPrice" HeaderText="Price"
SortExpression="imgPrice" />
<asp:BoundField DataField="imgSize" HeaderText="Size"
SortExpression="imgSize" />
<asp:BoundField DataField="imgResolution" HeaderText="Resolution"
SortExpression="imgResolution" />
<asp:BoundField DataField="imgPurchaseURL" HeaderText="Purchase URL"
SortExpression="imgPurchaseURL" />
<asp:BoundField DataField="imgUser" HeaderText="User"
SortExpression="imgUser" />
<asp:BoundField DataField="imgPurchaseDate"
HeaderText="Purchase Date" SortExpression="imgPurchaseDate" />
<asp:BoundField DataField="imgContractLength"
HeaderText="Contract Length" SortExpression="imgContractLength" />
<asp:BoundField DataField="imgExpirationDate"
HeaderText="Expiration Date" SortExpression="imgExpirationDate" />
<asp:BoundField DataField="imgPlannedUse" HeaderText="Planned Use"
SortExpression="imgPlannedUse" />
<asp:BoundField DataField="imgTotalImpressions"
HeaderText="Total Impressions"
SortExpression="imgTotalImpressions" />
<asp:BoundField DataField="imgPath" HeaderText="Path"
SortExpression="imgPath" />
<asp:BoundField DataField="imgWidth" HeaderText="Width"
SortExpression="imgWidth" />
<asp:BoundField DataField="imgHeight" HeaderText="Height"
SortExpression="imgHeight" />
<asp:BoundField DataField="imgSortOrder" HeaderText="Sort Order"
SortExpression="imgSortOrder" />
<asp:CheckBoxField DataField="imgInclude" HeaderText="Include"
SortExpression="imgInclude" />
</Fields>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
<EditRowStyle BackColor="#999999" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left"
/>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Left"
/>
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:DetailsView>
Charles Asbo...
Contributor
5512 Points
1186 Posts
Re: Detailsview -- hide empty rows using C#
Sep 28, 2007 08:49 PM|LINK
Try it this way
<
asp:DetailsView ID="Products" runat="server" EmptyDataRowStyle-Height="0px" EmptyDataRowStyle-Width="0px" AutoGenerateRows="False" DataSourceID="SqlDataSource1" Height="50px" Width="390px" CellPadding="4" ForeColor="#333333" GridLines="None">Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.