 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
 | This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

April 30th, 2009, 04:48 PM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter 14: Pages 491-492: Part of row doesn't show the black background
Imar:
I'm back with a new question. This pertains to the Try it Out on Pages 491 to 492.
When I first typed in the code, I could not get the CSS to show when I found a review with a “NO” Authorized on the Reviews.aspx. I reviewed the source code from Chp 14, even copied and pasted it over my pages and still no markup was showing.
Finally, I linked the Management.css to the ManagementMaster.master file. I got
part of the row to show the CSS. Now the white text is showing up on the row, but 2 of the columns in the row don’t show the black background. The two Columns that show the black background are the Title and Delete Columns. The Authorized and CreateDateTime Columns for that row have the white text but the black background does not show. It shows the Classic format for the Gridview control.
Any suggestions?
I really love this book
gfmann
|
|

May 1st, 2009, 03:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Good to hear you like the book.
How does the CSS class look for the columns? Like this:
Code:
.HighContrast, .HighContrast a
{
background-color: Black;
color: White; }
Notice how there are two selectors here: one class selector for HighContrast and one for all a elements inside the HighContrast class. Is the spelling and capitalization the same as shown above?
Imar
|
|

May 5th, 2009, 05:30 PM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Response about what CSS class looks like for the columns
Imar:
Yes. That's the code I have in the Management.css file.
Sorry for taking so long to get back with you.
v/r,
gfmann
|
|

May 6th, 2009, 03:06 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you show me the final HTML for the page?
Are you sure it's not a caching issue where the browser is using an old version of the CSS file? (press Ctrl+F5 in the browser to reload).
Otherwsise, can you post the relevant code for the pages?
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

May 6th, 2009, 10:05 AM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter 14:Pages 491-492
Imar:
It was a caching problem. Works now.
Thank you.
Again, "Two heads are better than one..." to work on a problem.
gfmann
|
|

May 6th, 2009, 01:42 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Absolutely!
Glad it's working now...
Imar
|
|

November 9th, 2009, 04:22 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 22
Thanks: 7
Thanked 0 Times in 0 Posts
|
|
Hi,
Just wanted to say that I just had this exact issue. Caching turned out to be the culprit also. Thanks for asking gfmann!
Chuck
|
|

February 24th, 2010, 06:11 PM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I cannot get the unauthorized Reviews to use the black background either.
I have followed the code exactly. Every Try It Out has worked for me up until now. I tried linking the ManagementMaster.master to the Management.css file using the following code:
Quote:
|
<link href="../App_Themes/Management/Management.css" rel="stylesheet" type="text/css" />
|
I tried refreshing the page, deleting all of my cookies and temporary internet files and it still doesn't work.
Anything else I can try?
Thanks,
Yaron
|
|

February 24th, 2010, 06:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Is it related to the code in the Code Behind or to the CSS? What happens when you debug the code, or make another change in the CSS file? Do you see those changes appear somewhere?
If that doesn't help, can you post more details and the relevant code of the markup, Code Behind and CSS sections?
Cheers,
Imar
|
|

February 25th, 2010, 11:49 AM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I tried adding "font-size: xx-large" to the CSS file. No luck there.
I know that the case statement executes because I put a stop in the code at that point. It executes twice. Once for each unauthorized Review. Additionally, I added a label to the bottom of the page that prints the CssClass property of each row item that is unauthorized. It prints "HighContrast" twice as expected for the Indie Rock category.
Here is the GridView markup, including the additional label I added (Reviews.aspx):
Quote:
<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Id">
<asp:ListItem Value="">Please make a selection</asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id"
DataSourceID="SqlDataSource2" onrowdatabound="GridView1_RowDataBound">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="AddEditReview.aspx?Id ={0}" DataTextField="Title"
HeaderText="Title" />
<asp:TemplateField HeaderText="Authorized" SortExpression="Authorized">
<ItemTemplate>
<asp:Label ID="lblAuthorized" runat="server" Text='<%# GetBooleanText(Eval("Authorized")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CreateDateTime" HeaderText="CreateDateTime"
SortExpression="CreateDateTime" DataFormatString="{0:g}" />
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />
</Columns>
</asp:GridView>
<a href="AddEditReview.aspx">Insert New Review</a><br />
<asp:Label ID="Label1" runat="server" ></asp:Label>
|
Here is the Code Behind source (Reviews.aspx.cs):
Quote:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
switch (e.Row.RowType)
{
case DataControlRowType.DataRow:
DataRowView myDataRowView = (DataRowView)e.Row.DataItem;
if (!Convert.ToBoolean(myDataRowView["Authorized"]))
{
e.Row.CssClass = "HighContrast";
Label1.Text += e.Row.CssClass.ToString() + "<br />";
}
break;
}
}
|
Here is the CSS class (Management.css):
Quote:
.HighContrast .HighContrast a
{
background-color: Black;
color:White;
font-size: xx-large;
}
|
Thanks for the help,
Yaron
|
|
 |