I have done a bit of research on this but none of the solutions I have found seem to provide a fix for my issue. I have an asp.net web app in C# and I want to dynamically add a submit button after a selection is made from a drop down list.
protected void Page_Load(object sender, EventArgs e)
{
submitButton.Text = "Submit";
submitButton.ID = "submitButton";
submitButton.Click += new EventHandler(submitButton_Click);
SelectionDropDownList.SelectedIndexChanged += new EventHandler(SelectionDropDownList_SelectedIndexChanged);
}
protected void SelectionDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
switch (SelectionDropDownList.SelectedIndex)
{
case 1:
//does a redirect
break;
case 2:
Panel1.Controls.Add(submitButton);
break;
case 3:
//does a redirect
break;
}
}
protected void submitButton_Click(object sender, EventArgs e)
{
//can't get this event to fire.
SubmitSearch();
}