On the formview is a button. When this button is clicked it sends an email to the DBAs asking for a database request to be run. This works as well.
However I would like to idiot proof this webform. I would like to restrict DBA requests to only the sql that is in Code submitted, testing, or pre prod status. Code that is in Hold, Failed, or Pending DBA should not be requested.
The simplest way to do this (I guess) would be to make the button invisible if the code status is one of the three listed. Simple enough.
The problem is that the button only goes invisible once it is clicked. I would like the button to not be there at all if the TicketStatus matches one of the three.
Help?
In my codebehind I have the following (I just set it up for the "Hold" status for now to test):
Expand|Select|Wrap|Line Numbers
- protected void Page_Load(object sender, EventArgs e)
- {
- string TicketStatus = ((Label)FormView1.FindControl("F5Label")).Text;
- Button EmailButton = ((Button)FormView1.FindControl("Button1"));
- if(TicketStatus.Equals("Hold"))
- {
- EmailButton.Visible = false;
- }
- }
Expand|Select|Wrap|Line Numbers
- <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Request DB" />