Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 721863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:55:20+00:00 2026-05-14T05:55:20+00:00

I have an asp.net web page (C# 2008) where the user would enter an

  • 0

I have an asp.net web page (C# 2008) where the user would enter an EmployeeID, and when they tab out of the textbox (the page executes a validation code block in the codebehind), they get a messagebox prompting them to select one of two values from a dropdown listbox.

The code for the message prompt in the codebehind is :

Response.Write("<script>window.alert('Please select Alpha or Beta')</script>");

After the prompt is displayed, and the user clicks “ok” and returns to the page, the text on the page appears distorted (the text in labels are a size larger, the labels get wrapped to another line etc)

I tried putting a Response.Redirect("UserProfileMaint.aspx"); after the messagebox in the codebehind, but now, the messagebox does not appear;

So this is my squence:

  • User enters EmployeeID
  • If user has NOT selected Alpha or
    Beta, then show messagebox
  • If user HAS selected Alpha or Beta,
    then don’t show messagebox

I want to display the messagebox validation, and ensure the appearance of the text on the page is not distorted. How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:55:21+00:00Added an answer on May 14, 2026 at 5:55 am

    Response.Write writes directly to the output stream, placing it before <html> which the browser gets very confused by (causing your text issues). What you want to do instead is this:

    ClientScript.RegisterStartupScript(GetType(), "alert", 
                                      "alert('Please select Alpha or Beta');", true);
    

    ClientScript.RegisterStartupScript includes the script in the page to be run on load rather than put in the response too early. The last argument: true is telling it to wrap that alert in <script> tags, keeping your code-behind cleaner.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site
I have an asp.net web page created with web forms. It has a number
i have an asp.net-mvc web page and i am using jqgrid on the front
Can I pass a custom object between AJAX enabled WCF and my asp.net page?
I am stuck with asp.net post issue with last 2 weeks. Scenario: My application
I am creating mobile application in asp.net webform targeting IPhone, Android and blackberry. I
I have a doubt concerning the Entity Framework in .NET. I have a simple
I use Silverlight, .NET 4 (with VB), RIA Services, and I develop under VS
I am developing a web based mmorpg. so speed is very vital for me
I'm having an issue with my Dev environment where any calls to the Caching

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.