question

RandallDonaldson-9099 avatar image
0 Votes"
RandallDonaldson-9099 asked AlbertKallal-4360 answered

Buttons not appearing serverside, but run in Visual Studio

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


windows-server-iisdotnet-aspnet-general
img1.png (2.9 KiB)
img2.png (3.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RandallDonaldson-9099 In addition to caching, I think it may also be caused by Response.Redirect(), but it is impossible to reproduce your problem based on your description, please post more details information about your issue.

0 Votes 0 ·
AlbertKallal-4360 avatar image
0 Votes"
AlbertKallal-4360 answered

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.




image.png (8.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RandallDonaldson-9099 avatar image
0 Votes"
RandallDonaldson-9099 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.