Showing posts with label colors. Show all posts
Showing posts with label colors. Show all posts

Wednesday, March 28, 2012

Change Color of Header and Content in Accordian

How do I change the Header and Content sections of the Accordian to different colors? The AccordionPan bgcolor changes both to the same color. Do you have to use a stylesheet to perform this action? If so can someone give me and example that would work?

Thank you for your help.

No suggestions ?
To change the Accordian Header and Content Colors, follow these 3 steps...

First you must create or edit your existing styleesheet of your application, the following two items need to be added.

.accordionHeader

{

background-color:blue;

color:white;

}

.accordionContent

{

background-color:#e4e4e4;

}

2nd in the webform between the <head> tags include the link href stylesheet like so.....

<headrunat="server">

<linkhref="StyleSheet.css"rel="stylesheet"type="text/css"/>

</head>

Third edit the AccordionPan tag or tags to accordionHeader and accordionConten settings like so...

<ajaxtoolkit:AccordionPaneID="AccordPane1"HeaderCssClass="accordionHeader"ContentCssClass="accordionContent"runat="server">

Run your app and the setting should be visible now.

Monday, March 26, 2012

Cell colors odd behaviour in DetailsView

I have a page with an Atlas updatePanel and a detailsview in editMode.

I also have a save button that is responsible for updating the detailsview and run a custom command (runChecks) that basically does the following:

- check if a textbox in the detailsview is within a specific range of values; if it is not, color the detailsview's cell in red;

Currently the SaveButton Command code is:

runChecks(); DetailsView1.UpdateItem(true);//DetailsView1.Dispose(); DetailsView1_DataBound(sender, e);

My problem is that if I change the value from "good" to "bad" and click the save button, the cell is not colored red. It only changes color if I refresh the page.

Oddly, if I change from "bad" to "good", I don't need the refresh for the color to be in its default value.

If the TextBox's autopostBack is set to true, the cell will become colored red after I change it to a "bad" value but the color dissappears when I click save. Again, it will reappear in red if I refresh the page.

Why is this happening and how can I prevent the red color from dissappear when I click save?

Thank you!

FYI, what the runChecks currently does is:

protected void runChecks() {bool valid =true; DemographicsCriteria criteria =new DemographicsCriteria(1,null,null); valid = valid && criteria.editCheck("Age", ((TextBox)DetailsView1.FindControl("ageTextBox")).Text, DetailsView1.Rows[2].Cells[1]); valid = valid && criteria.editCheck("Gender", ((RadioButtonList)DetailsView1.FindControl("genderRB")).SelectedValue, DetailsView1.Rows[3].Cells[1]);if (valid ==false) { warningLabel.Visible =true; }else { warningLabel.Visible =false; } }

where editCheck is:

public bool editCheck(string filter,string value, TableCell cell) { DataRow[] criteriaRow;switch (filter) {case"Age": {int valueInt = _code.convertStringToInt(value); criteriaRow = selectDemographicsCriteria(filter);if (((int)criteriaRow[0][_minimumVIndex]) >= valueInt || valueInt >= ((int)criteriaRow[0][_maximumVIndex])) { cell.BackColor = _errorColor;return false; }else {return true; } }break;case"Gender": {if (value !="M") { cell.BackColor = _errorColor;return false; }else {return true; } }break;default:return true;break; } }