I
Islam Elkhayat
I have master datagrid & master details in 5 panels each belong to diffrent
dbtable. I have a dropdpwn list to switch which panel to be visible..
I also have one navigation bar for add, update, delete and i need to the
button to work with the visible panel but the click event don't fire, here
is my code for the dropdownlist selectedindex change:
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
switch(DropDownList1.SelectedIndex)
{
case 0 :
ResetPanelVisiblity();
Panel1_PersonalInfo.Visible = true;
this.bt_new.Click += new EventHandler(this.Panel1_NewRecord);
this.bt_edit.Click += new EventHandler(this.Panel1_UpdateRecord);
this.bt_delete.Click += new EventHandler(this.Panel1_Delete);
break;
case 1:
ResetPanelVisiblity();
Panel2_Photo.Visible = true;
this.bt_new.Click += new EventHandler(this.Panel2_NewRecord);
this.bt_edit.Click += new EventHandler(this.Panel2_UpdateRecord);
this.bt_delete.Click += new EventHandler(this.Panel2_Delete);
break;
------------------------------------------------
if i implement a switch case(or if statment) for each button to call methods
it' work.
So How can i fix this problem without use switch case for each button click
event??
regards
dbtable. I have a dropdpwn list to switch which panel to be visible..
I also have one navigation bar for add, update, delete and i need to the
button to work with the visible panel but the click event don't fire, here
is my code for the dropdownlist selectedindex change:
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
switch(DropDownList1.SelectedIndex)
{
case 0 :
ResetPanelVisiblity();
Panel1_PersonalInfo.Visible = true;
this.bt_new.Click += new EventHandler(this.Panel1_NewRecord);
this.bt_edit.Click += new EventHandler(this.Panel1_UpdateRecord);
this.bt_delete.Click += new EventHandler(this.Panel1_Delete);
break;
case 1:
ResetPanelVisiblity();
Panel2_Photo.Visible = true;
this.bt_new.Click += new EventHandler(this.Panel2_NewRecord);
this.bt_edit.Click += new EventHandler(this.Panel2_UpdateRecord);
this.bt_delete.Click += new EventHandler(this.Panel2_Delete);
break;
------------------------------------------------
if i implement a switch case(or if statment) for each button to call methods
it' work.
So How can i fix this problem without use switch case for each button click
event??
regards