Buttons not appearing serverside, but run in Visual Studio

Randall Donaldson 1 Reputation point
2022-06-20T19:55:23.887+00:00

I have an ASP.NET Web Application that lets the user scan a barcode into a TextBox, which once the scan completes it searches a SQL Server database and updates a Label with some additional information. This works fine.

My manager has asked me to add a Button to reset the value of the TextBox. I add a Button object in Design View from the Toolbox, and I've code to do a Response.Redirect() back to the same aspx page. This works as intended when I run it inside Visual Studio at development time. However, when I publish the application, the button doesn't even appear on the form.
If you select that area where the button should be, there's a blue line instead. It's like there's a dependency that's not being built into the application files that are published. Alternately, it could be that the button is being blocked either by IIS or by the browser. Any suggestions or ideas?

213085-img2.png
213131-img1.png

Internet Information Services
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,282 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Albert Kallal 4,731 Reputation points
    2022-06-20T20:54:43.65+00:00

    sounds like some css style sheet or some such is not making it to the server at publish time. Do all web users experience this, or just you and your browser during testing? I would try hitting ctrl-F5 while looking at this page (that re-sets your code and browser cache). If that does not work, then try empty your browser (clear cache and cookies) - see if that helps. You could also hit f12 (browser debug tools - edge, chrome, firefox), and select elements, and check what the css and formatting of the button is seeing - or perhaps if you have bootstrap installed (most sites - even older web forms ones) have boot strap, so you could try say this:

    213066-image.png

    I can only say I have in the past wasted 2 full days - only to find out that clearing out my browser cache fixed the issue. Often stuff and junk from developing all day long will persist in the browser. Also, try a different browser if have several installed (like I do for testing). And try the browser debug f12, and select elements - you can quick test/see what css styling is being applied to that button.

    0 comments No comments

  2. Randall Donaldson 1 Reputation point
    2022-06-21T13:44:44.137+00:00

    Good news. Even though I was clearing the cache, I either wasn't clearing everything or wasn't going back far enough. Cleared the cache for all time, every checkbox, and now it's working as expected! Glad it was so simple and thanks for reiterating the cache problem. I was convinced I'd cleared it well enough, but I was wrong.

    0 comments No comments