Showing posts with label cell. Show all posts
Showing posts with label cell. Show all posts

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; } }

Catching drop event in atlas drag and drop

Hi I want to drag a GridView cell and drop it on another GridView and adding a new row in second gridview based on the dragged element name. Is there any method by which I can capture the drop event .Have you tried using theReorderList Control?

Thanks Shepherd. But I want to use drag and drop between two GridView's. ReorderList does not work properly for this purpose. Moreover I tried to use ReorderList with DataSource and it gives me error while reordering. Can u help me regarding this. And I want to execute a Insert command on drop event.

Thanks.


@.Kanwar,

To my knowledge this is not supported yet. I've read requests for this functionality on the AJAX Control Toolkit Codeplex site, but I don't know of any official plans to add it. I assume that it is possible, and that you could build it yourself if you have time...you might also look into some third party controls like Telerik or Infragistics. I don't know if they have controls like this, but they are usually a little ahead of the curve feature-wise. I hope this is helpful.


Best Regards...


Thanks. I am trying to build Ajax template for this.
Best of luck to you.