Hello All
I created a listview in which items along with checkboxes are created Dynamically.
Now when items and checkboxes are created then I want to fire event for checkbox(which give the checked state of current checkbox)
I Didnt Find event for that
yes I want to fire checked event on checking.
Actually I select a pArticular user from combobox and on that selected item I show three list boxes along with items.
private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
String TabName, TabCaption, GroupName, GroupCaption, ItemName, ItemCaption, ControlName, ControlCaption;
string username = cmbauthority.SelectedItem.ToString();
UserDao autodao = new UserDao();
User authuser = autodao.selctid_accname(username);
int Useridd = authuser.Id;
UserTabDao uTdao21 = new UserTabDao();
DataSet UTds11 = uTdao21.Select_TabID(Useridd);
TabDao tabdao21 = new TabDao();
DataSet datset2 = new DataSet();
string name, caption;
for (int l = 0; l < UTds11.Tables[0].Rows.Count; l++)
{
int tabidd11 = Convert.ToInt32(UTds11.Tables[0].Rows[l][0]);
bool active = Convert.ToBoolean(UTds11.Tables[0].Rows[l][1]);
datset2 = tabdao21.select_acctabid(tabidd11);
name = Convert.ToString(datset2.Tables[0].Rows[0][0]);
caption = datset2.Tables[0].Rows[0][1].ToString();
if (active == true)
{
this.listView1.Items.Add(name, caption).Checked = true;
GroupDao gpdao = new GroupDao();
DataSet dsg1 = gpdao.selectgpid(Useridd, tabidd11);
int gpidd;
DataSet fds = new DataSet();
for (int h = 0; h < dsg1.Tables[0].Rows.Count; h++)
{
gpidd = Convert.ToInt32(dsg1.Tables[0].Rows[h][0]);
bool activestate = Convert.ToBoolean(dsg1.Tables[0].Rows[h][1]);
DataSet gpu = gpdao.selectnameall(gpidd);
string gname, gcaption;
for (int r = 0; r < gpu.Tables[0].Rows.Count; r++)
{
gname = gpu.Tables[0].Rows[r][0].ToString();
gcaption = gpu.Tables[0].Rows[r][1].ToString();
if (activestate == true)
{
this.listView2.Items.Add(gname, gcaption).Checked = true;
UserControlDao usdao = new UserControlDao();
DataSet ds45 = usdao.slectitemsfromcontrols(Useridd, gpidd);
int controlid;
ControlsDao cdao09 = new ControlsDao();
DataSet ds54 = new DataSet();
for (int y = 0; y < ds45.Tables[0].Rows.Count; y++)
{
controlid = Convert.ToInt32(ds45.Tables[0].Rows[y][0]);
bool checkforactive = Convert.ToBoolean(ds45.Tables[0].Rows[y][1]);
ds54 = cdao09.selectnamecontorls(controlid);
string cnamerr = ds54.Tables[0].Rows[0][0].ToString();
string ccaption = ds54.Tables[0].Rows[0][1].ToString();
if (checkforactive == true)
{
listView3.Items.Add(cnamerr, ccaption).Checked = true;
}
}
}
else
{
this.listView2.Items.Add(gname, gcaption).Checked = false;
}
}
}
}
else
{
this.listView1.Items.Add(name, caption).Checked = false;
}
}
}