How do I display NO text next to items in a CheckBoxList??
-
I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???
-
I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???
If nobody suggests a better way, why don't you have an extra column in your data table that is never populated and bind it to that? Or even populate that field with your custom text by hand rather than from the database? Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song -
I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???
I came across this when looking for something else, not sure if it will help or not but here it is anyway: Top Questions about the DataGrid Web Server Control Selecting Multiple Items Using a Check Box (Hotmail Model) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchtopquestionsaboutaspnetdatagridservercontrol.asp[^]
I support two teams - The Canucks and whoever is playing the Leafs[
-
I have a CheckBoxList that is databound to a Dataview. I set its DataValueField to point to one column in the Dataview so that when it's checked, I will ge receiving the data I need. But I do not want any text to be displayed next to the checkboxes. I want to create my own customized label for each checkbox. So, I did not set the DataTextField property. However, each checkbox is still displayed with text next to it. The text shown is the same as what I had set for its DataValue field. Even if I dont set both the DataTextField and the DataValueField, it still displays "System.Data.DaraRowView" next to the checkboxes!! How do I do it so that it will display nothing except the checkboxes???
You could also loop through your list after you databind and either remove the text or add your custom labels. foreach (ListItem li in checkBoxList.Items) { li.Text = String.Empty; }