<asp:CheckBoxList ID="ckl_EditRole" DataValueField="RoleName" runat="server">
</asp:CheckBoxList>
public void BindListBoxPermission(int field)
{
MySqlCommand command = new MySqlCommand();
DataSet ds = new DataSet();
int newOrgID = field;
string MysqlStatement = "SELECT RoleName from tbl_Role Where RoleID >1 order by RoleID desc";
MySqlParameter[] param = new MySqlParameter[0];
ds = server.ExecuteQuery(CommandType.Text, MysqlStatement, param);
ckl_EditRole.DataSource = ds;
ckl_EditRole.DataBind();
}
For each item tooltip is different, for admin tooltip is creates user and for users tooltip is creates message. How can I add tooltip for each item inside the check box
Use the ToolTip property:
Is this what you are asking?
If you want to update the ToolTip for each item then you need to treat them separately:
You can use PreRender event-- loop over the items (should be ListItems), and you can set an html attribute for title based on the values of the checkbox.
In cases where I want to have alot of control over the checkboxes, I might favor putting a checkbox in a repeater-- but that might not be necessary here.
You can write the following snippet of code on the page load method: chkbox.Items[0].Attributes.Add("Title", "Admin"); chkbox.ToolTip = "Admin";
chkbox.Items[1].Attributes.Add("Title", "User"); chkbox.ToolTip = "User";
This is what I use, with more features, like making the ListItem look like a linkbutton.
So in effect I am placing a ToolTip that's unique based on the data from the DatSource and I change the appearance of the ListItem to blue underline.