ASP Button not displaying on Windows 2012 Server
-
I've an application that displays information in a gridview:
the status of the button is set
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView entry = e.Row.DataItem as DataRowView;
if (entry != null)
{
switch (entry["State"] as string)
{
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[ -
I've an application that displays information in a gridview:
the status of the button is set
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView entry = e.Row.DataItem as DataRowView;
if (entry != null)
{
switch (entry["State"] as string)
{
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[Did you try to look into, why it was empty? Your server's variables are not shown to us and we cannot debug it without enough information.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Did you try to look into, why it was empty? Your server's variables are not shown to us and we cannot debug it without enough information.
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
besides debugging the application and stepping through the code that sets the buttons values what else can I do? In my test the code is hitting this case within the switch:
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[1]).Text = "Start";
((Button)e.Row.Cells[7].Controls[1]).ForeColor = System.Drawing.Color.Green;
((Button)e.Row.Cells[7].Controls[1]).CommandArgument = entry["Site"] as string + "|" + entry["Description"] as string;
break;but when to code has finished running and the webpage is displayed, here's the source of the webpage:
[Description](javascript:__doPostBack\('UcSites1$GridView1','Sort$Description'\))[Identifier](javascript:__doPostBack\('UcSites1$GridView1','Sort$Identifier'\))[State](javascript:__doPostBack\('UcSites1$GridView1','Sort$State'\))[Host Header Value](javascript:__doPostBack\('UcSites1$GridView1','Sort$HostHeaderValue'\))[IP Address](javascript:__doPostBack\('UcSites1$GridView1','Sort$IPAddress'\))[Port](javascript:__doPostBack\('UcSites1$GridView1','Sort$Port'\))[SSL Port](javascript:__doPostBack\('UcSites1$GridView1','Sort$SSLPort'\))Button Default Web Site1Stopped 80
You can see the cell[2] is updated with an OrangeRed background and white text. I've followed the code the whole way through and there is no where else it is manipulated, very strange. What this application does is it reviews the status of Sites setup in IIS and displays their status in the gridview and if the site status = stopped the button should display 'start' and so on.
-
I've an application that displays information in a gridview:
the status of the button is set
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView entry = e.Row.DataItem as DataRowView;
if (entry != null)
{
switch (entry["State"] as string)
{
case "Stopped":
e.Row.Cells[2].BackColor = System.Drawing.Color.OrangeRed;
e.Row.Cells[2].ForeColor = System.Drawing.Color.White;
((Button)e.Row.Cells[7].Controls[pmcm wrote:
the column with the button is empty
If the column is empty that means you have code somewhere that is hiding the button, .Visible = false; or some other code that is messing something up.
There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.
-
pmcm wrote:
the column with the button is empty
If the column is empty that means you have code somewhere that is hiding the button, .Visible = false; or some other code that is messing something up.
There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.
-
turns out there was a database query that runs to validate the server is in an admin group after the button is set, atm the query is returning null so this is why the button is being disabled. Thanks for all the advice/help