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

  • SEARCH
  • Home
  • 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 4344476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:54:09+00:00 2026-05-21T11:54:09+00:00

I am using RequiredFieldValidator in my asp.net program. I have a sign out button

  • 0

I am using RequiredFieldValidator in my asp.net program. I have a sign out button which is used to terminate the session, but when i click on this sign out button without inserting any values in any of the text box the RequiredFieldValidator throws an error and i am not able to sign out.

I want to sign out a user without inputting any of the values in the textbox.

Please check my code in case of any problem in my code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class EntryForm : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {// CHEK SESSION VARIABLE AND LOAD dropdownlist1 WITH VALUES
        if (!IsPostBack)
        {
            String DB = "";
            String AccountID = "";
            if (Session["login"] != null && Session["db"] != null)
            {
                AccountID = Session["login"].ToString();
                DB = Session["db"].ToString();

                Label9.Text = AccountID;
            }
            else
            {
                Response.Redirect("log.aspx");
            }
            HiddenField1.Value = DB.ToString();
            DropDown a = new DropDown();
            a.filldropdown1(this.DropDownList1, DB);
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        // LOG OUT***********////////////
            Session.Abandon();
            Response.Redirect("log.aspx");

    }

.aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EntryForm.aspx.cs" Inherits="EntryForm" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit.HTMLEditor" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 330px;
        }
        .style2
        {
            text-align: center;
        }
        .style3
        {
            text-align: center;
            width: 38px;
        }
        .style4
        {
            text-align: center;
            width: 109%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table style="width:90%; height: 30px;">
        <tr>
            <td class="style1">
                &nbsp;<asp:Label ID="Label8" runat="server" style="text-align: left" 
                    Text="Welcome"></asp:Label>
&nbsp;<asp:Label ID="Label9" runat="server" style="text-align: left"></asp:Label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
            <td align="center" width="100%" style="text-align: right">
                <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" 
                    style="text-align: right">Log Out</asp:LinkButton>
                &nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
    </table>
    </div>
    <table style="width:95%;" align="center" bgcolor="Silver">
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Type :  "></asp:Label>
&nbsp;
                <asp:DropDownList ID="DropDownList1" runat="server">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                    ControlToValidate="DropDownList1" ErrorMessage="*" 
                    InitialValue="&lt;-- Select --&gt;">*</asp:RequiredFieldValidator>
            </td>
            <td>
                <asp:Label ID="Label2" runat="server" Text="No. :"></asp:Label>
&nbsp;<asp:TextBox ID="TextBox1" runat="server" Width="75px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="TextBox1" ErrorMessage="*">*</asp:RequiredFieldValidator>
            </td>
            <td>
                <asp:Label ID="Label3" runat="server" Text="Year :"></asp:Label>
&nbsp;
                <asp:TextBox ID="TextBox2" runat="server" Width="75px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="TextBox2" ErrorMessage="Enter Year">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="TextBox2" ErrorMessage="Enter year" 
                    ValidationExpression="^\d{4}$">YYYY</asp:RegularExpressionValidator>
            </td>
                <td>
                    <asp:Label ID="Label4" runat="server" Text="Order Date : "></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server" Width="75px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Enter proper format">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Enter valid date" 
                        ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$">dd/mm/yyyy</asp:RegularExpressionValidator>
            </td>
                <td>
                    <asp:Button ID="Button2" runat="server" Text="GO" onclick="Button2_Click" />
            </td>
        </tr>
    </table>
    <br />
    <table style="width:100%;">
        <tr>
            <td style="text-align: center">
                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" 
                    style="text-align: center" Visible="False" 
                    onselectedindexchanged="DropDownList2_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <br />
    <table style="width:100%;">
        <tr>
            <td style="text-align: center" width="100%">
                <asp:Label ID="Label5" runat="server" Text="Label" Visible="False" 
                    style="text-align: center"></asp:Label>
            </td>
            <td style="text-align: center" width="100%">
                <asp:Label ID="Label6" runat="server" Text="Vs" Visible="False"></asp:Label>
            </td>
            <td style="text-align: center" width="100%">
                <asp:Label ID="Label7" runat="server" Text="Label" Visible="False"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    <table style="width:100%;" border="1">
        <tr>
            <td class="style3" width="100%">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
            <td class="style4" width="100%">
                <cc1:Editor ID="Editor1" runat="server" Width="60%" AutoFocus="true" 
                    style="text-align: right" />
            </td>
            <td class="style2" width="100%">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        </tr>
    </table>
    <br />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
                            </asp:ScriptManager>
    <asp:HiddenField ID="HiddenField1" runat="server"/>
    </form>
    </body>
</html>
  • 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-21T11:54:10+00:00Added an answer on May 21, 2026 at 11:54 am

    On your Sign Out button set CausesValidation property to false

    <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" 
                        CausesValidation="False"
                        style="text-align: right">Log Out</asp:LinkButton>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on
I have this membership site setup on my local machine using the ASP.NET membership
I want to disable a ASP.NET RequiredFieldValidator with JavaScript. Actually I'm using the following
I have a RequiredFieldValidator with Display=Dynamic on my ASP.NET WebForm. I have assigned it
I am using asp.net 3.5 with the ajax toolkit. The problem: I have a
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
I'm using ASP.NET WebForms and using some validation like the following: <asp:TextBox runat=server ID=txtUserName
I'm trying to do something that sounds fairly simple using ASP.NET 3.5. A user

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.