I came across this code today. This is the ultimate anti-pattern for ASP.NET and jQuery. The idea here is that when a user clicks on the cdbDriverConsent checkbox; if the customer account is "inProbation", the "probationBox" will slide down with further instructions. The problem is, when looking at strictly the markup. There is absolutely no way of knowing that this is what is happening. The markup looks like this: ' ToolTip="I attest" /> ... In the code behind the OnItemDatabind function grabs the checkbox and assigns a jQuery click handler: protected void dgDIR_OnItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ... if (IsOnProbation()) { ...
A collection of hard earned code snippets in c#, SQL, JavaScript, HTML and other languages.