Code being called twice in my ASPX Code behind??

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Code being called twice in my ASPX Code behind??

    Hi,

    I have an ASP.Net application.

    I have an aspx page with a button that submits the page.

    In my codebehind I check if it is a postback and
    instantaite a class and use a method of the class.

    On coming back from the class I instantiate it hits the
    End If of where I check it is a PostBack and runs through
    the code again.

    Am new to ASPX.

    Anyone know what could be wrong?

    Thanks,
    C.
    C Guest

  2. Similar Questions and Discussions

    1. error adding a proxy in the code behind aspx page
      Why cant i add a proxy(service) in the following code...this aspx.cs using System.ComponentModel; using System.Data; using System.Drawing; using...
    2. Passing code/data from code-behind to ASPX page
      I have the following code in my code-behind file: DataGrid MAPPsDataGrid = (DataGrid)((((((Repeater) sender).Parent).Parent).Parent).Parent); ...
    3. using code behind variables in .aspx
      avs: If its a WebControl then you can acess it in codebehind already. In codebehind you need this line: yourtableid.width = intWidth --...
    4. Can I compile regular ASP-code in to an aspx-file?
      Hi everyone, i've heard that aspx-files can be compiled code so that the webserver just have to deal with the code once, is that true? I'm a...
    5. dynamically generate aspx code
      As far as dynamically creating bound columns take a look @ http://www.c-sharpcorner.com/Code/2003/June/DisplayBoundColumnBased.asp "Keith Langer"...
  3. #2

    Default Re: Code being called twice in my ASPX Code behind??



    Here is the codebehind my ASPX..


    Public Class RetrievePassword
    Inherits System.Web.UI.Page

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private
    Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is
    required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As
    System.Object

    Private Sub Page_Init(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web
    Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Public strResponse As String
    Private Sub Page_Load(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here


    If IsPostBack() Then
    'Call RetrievePassword Function in User Class
    If Request.Form("txSubmit") = "Go" Then
    Dim strUserName As String = Request.Form
    ("txUserName")
    Dim objUser As User = New User
    'Retrieve password and email to user
    objUser.RetrievePassword(strUserName)
    strResponse = "Your Password will be sent
    to your EMail account"
    objUser = Nothing
    End If
    End If

    End Sub

    End Class


    C Guest

  4. #3

    Default Re: Code being called twice in my ASPX Code behind??

    is your AutoEventWireup set to true ?

    Natty Gur, CTO
    Dao2Com Ltd.
    34th Elkalay st. Raanana
    Israel , 43000
    Phone Numbers:
    Office: +972-(0)9-7740261
    Fax: +972-(0)9-7740261
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139