R
R Duke
I have tried everything I can think of to change the visible property
of a design time created control from a dynamically created control's
command event handler.
Here is the scenario.
I have a WebForm with some textboxes, dropdownlists, a panel,
imagebutton and so on. When I click on the image button (which was
created at design time) I dynamically build a table. In each of row of
that new table I put several cells and one cell contains an image
button. I am able to successfully get the event handler of this
dynamically created image button to fire (regardless of the row I am
clicking), but in the event handler I am setting the design'time
created panel's visible property to true but it doesn't actually do
anything. So I created a dummy textbox at design time and just tried
to set the text value of that textbox in the same dynamically created
image button event. It doesn't work. I know the event is firing
because I have debugged through it, but it doesn't actually change the
textbox text value even though the code runs.
Why can't I access the design-time controls of the form from my
dynamically created object's event handler?
Here is my event handler code:
string trackNum = e.CommandArgument.ToString();
this.lblArtistSearchType.Text = "Select Track " + trackNum + "
Artists";
this.txtHiddenArtistSearch.Text = "Unhide";
this.txtHiddenArtistSearchType.Text = trackNum;
this.pnlArtistSelection.Visible = true; <-- Doesn't work
Thank you,
Rodney
of a design time created control from a dynamically created control's
command event handler.
Here is the scenario.
I have a WebForm with some textboxes, dropdownlists, a panel,
imagebutton and so on. When I click on the image button (which was
created at design time) I dynamically build a table. In each of row of
that new table I put several cells and one cell contains an image
button. I am able to successfully get the event handler of this
dynamically created image button to fire (regardless of the row I am
clicking), but in the event handler I am setting the design'time
created panel's visible property to true but it doesn't actually do
anything. So I created a dummy textbox at design time and just tried
to set the text value of that textbox in the same dynamically created
image button event. It doesn't work. I know the event is firing
because I have debugged through it, but it doesn't actually change the
textbox text value even though the code runs.
Why can't I access the design-time controls of the form from my
dynamically created object's event handler?
Here is my event handler code:
string trackNum = e.CommandArgument.ToString();
this.lblArtistSearchType.Text = "Select Track " + trackNum + "
Artists";
this.txtHiddenArtistSearch.Text = "Unhide";
this.txtHiddenArtistSearchType.Text = trackNum;
this.pnlArtistSelection.Visible = true; <-- Doesn't work
Thank you,
Rodney