private void button2_Click(object sender, EventArgs e) { try { int val = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value); if (option == "Maintain Template") { label1.Text = "Maintain Template"; UCMaintainTemp MaintainTemplate = new UCMaintainTemp(val); panel1.Controls.Add(MaintainTemplate); MaintainTemplate.BringToFront(); MaintainTemplate.Dock = DockStyle.Fill; } else if (option == "Publish Template") { label1.Text = "Publish Template"; UCNotification.UCPublishNotifTemplate publish = new UCNotification.UCPublishNotifTemplate(val); panel1.Controls.Clear(); panel1.Controls.Add(publish); publish.BringToFront(); publish.Dock = DockStyle.Fill; } } catch (NullReferenceException) { MessageBox.Show("Please specify your marketing template search details first"); } }
private void button2_Click(object sender, EventArgs e) { UCNotification.UCPublishNotifTemplate publish = new UCNotification.UCPublishNotifTemplate(); panel1.Controls.Clear(); panel1.Controls.Add(publish); publish.BringToFront(); publish.Dock = DockStyle.Fill; }