
The Infor CRM implementation of a checkbox does not use a standard ASP.Net CheckBox control. Instead it uses its own control implementation that inherits from the CheckBox control.
One of the things that I struggled with recently was how to both change the text showing with the CheckBox as well as change the color of that text, based on if the checkbox was checked or not. I had initially tried to use client side code to alter the appearance but that quickly hit a dead end because on postbacks the server definitions came back and replaced whatever alterations I made client side.
The solution was to use server side code on the Change action of the checkbox control. This is what I came up with. Changing the label was easy, just setting the Text property. But to change the color I had to actually append a style attribute to the page header. In the sample I was using the Is Primary Checkbox on the Contact Detail screen. All of this code is running on a Load Action with the OnRepaint set to true.
IContact con = this.BindingSource.Current as IContact; if (con.IsPrimary.HasValue && con.IsPrimary.Value) chkIsPrimary.Text = "Yes"; else chkIsPrimary.Text = "No"; var checkStyle = "$('head').append('<style type=\"text/css\"> label[for=" + chkIsPrimary.ClientID + "] { color: " + (chkIsPrimary.Checked ? "red":"black") + "; } </style>');"; ScriptManager.RegisterClientScriptBlock(this, GetType(), "checkScript", checkStyle, true);
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!