Hi
I am trying to write a c# asp.net web app that shows which SQL jobs are running. The web app has start and stop buttons but I only want to show the start button if the job is stopped or show the stop button if the job is currently running. So how do I hide buttons based on the results of a SQL query.
Thanks
Mike
Loading
Madhu KPosted Nov 11, 2010, 8:01 AM
In Row DataBound Event
check the database for whether the job is running or stopped
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Button btnStart = e.Row.FindControl("Button1") as Button;
// Button btnStop = e.Row.FindControl("Button2") as Button;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if(job is running)
{
btnStop.Visible = true;
}
else
{
btnStart.Visible = true;
}
}
MikePosted Nov 11, 2010, 10:56 AM