I have run into a couple of issues with ASP.NET CheckBox server controls. When a CheckBox is nested inside an ItemTemplate inside a Repeater control, the CheckedChanged event doesn’t fire for me. But let's say the Text of each CheckBox is set like this:
Text='<%# DataBinder.Eval(Container, "DataItem.columnX")%>’ CssClass="hideme"
where the hideme CSS class looks like:
<style>.hideme LABEL { DISPLAY: none }</style>
The result is that each checkbox can have a unique Text property, and the CSS class makes it invisible, so it's essentially a custom control property. Then do:
foreach (RepeaterItem dataItem in RepeaterDataTable.Items)
{
CheckBox itemCb = (CheckBox) dataItem.FindControl("CheckBox1");
...
The loop gets at each CheckBox and you can then see the Text property.
Also, an onclick property can be specified for a CheckBox, but the CheckBox server control has no such documented property. Microsoft documents that arbitrary attributes can be applied to the rendered HTML control. For example, a CheckBox is rendered as an HTML input control of type checkbox. A CheckBox can be created to call a JavaScript function, client-side, by adding the following line to a code-behind method:
cb1.Attributes.Add("onclick", "jsFunc();");
The CheckBox will also invoke server-side methods as usual.
Useful information Thanks for sharing it
ReplyDeleteDot Net Training in Chennai
very nice post blog.........
ReplyDeleter programming training in chennai
internship in bangalore for ece students
inplant training for mechanical engineering students
summer internships in hyderabad for cse students 2019
final year project ideas for information technology
bba internship certificate
internship in bangalore for ece
internship for cse students in hyderabad
summer training for ece students after second year
robotics courses in chennai