Is This a bug???

Results 1 to 2 of 2

Thread: Is This a bug???

  1. #1
    Join Date
    Dec 1969

    Default Is This a bug???

    I have an ASP.NET Page with Web Forms controls. I use ASP .NET with VB.NET.<BR>I have 3 Buttons (Charge, Save and Cancel), 1 Textbox, 1 RequieredFieldValidator associate with the textbox and 1 label.<BR>The button Charge and the Button Cancel have CausesValidation = FALSE and the button Save has CausesValidation = TRUE.<BR>Let’s suppose that the only one which has code is the CANCEL button because what I want to demonstrate is that certain circumstances the RequiredFieldValidator and the CausesValidation of the buttons seam to generate a strange behavior. <BR>The code of the Cancel button is: label1.Text: Cancel Code executed.<BR>When I execute the WebForm I need to press the Charge button (in this example it doesn´t have code), and then I press the button SAVE (in this example it doesn´t have code), here fire the RequiredFieldValidator. From this moment any code is not going to be executed (really it executed but does’nt response).<BR> For example probe pressing Cancel button (this must show in the label CANCEL EXECUTED but it does’nt make it).<BR><BR>What happens? Is This a bug???? How can I resolve it???<BR><BR>THAT’S DE CODE EXAMPLE: <BR><BR>&#060;code&#062;<BR><BR>Public Class WebForm1<BR> Inherits System.Web.UI.Page<BR> Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox<BR> Protected WithEvents BtnSave As System.Web.UI.WebControls.Button<BR> Protected WithEvents btnCancel As System.Web.UI.WebControls.Button<BR> Protected WithEvents Button1 As System.Web.UI.WebControls.Button<BR> Protected WithEvents RequiredFieldValidator1 As System.Web.UI.WebControls.RequiredFieldValidator<B R> Protected WithEvents Label1 As System.Web.UI.WebControls.Label<BR><BR>#Region " Web Form Designer Generated Code "<BR><BR> &#039;This call is required by the Web Form Designer.<BR> &#060;System.Diagnostics.DebuggerStepThrough()&#06 2; Private Sub InitializeComponent()<BR><BR> End Sub<BR><BR> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<BR> &#039;CODEGEN: This method call is required by the Web Form Designer<BR> &#039;Do not modify it using the code editor.<BR> InitializeComponent()<BR> End Sub<BR><BR>#End Region<BR><BR> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<BR> &#039;Put user code to initialize the page here<BR> End Sub<BR><BR><BR> Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click<BR> Label1.Text = "CANCEL EXECUTED"<BR> Response.Redirect("default.aspx?a", False)<BR><BR><BR> End Sub<BR><BR><BR>End Class<BR><BR>&#060;/code&#062;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Is This a bug???

    When you redirect to that page, it starts fresh and re-initializes. The state of the page will not be saved if you redirect. Try commenting out that line of code:<BR><BR>&#039;Response.Redirect("default.aspx ?a", False)<BR><BR>You&#039;ll see that it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts