CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 OnClick handler

Print topic Send  topic

Author Message
drpcken

Posts: 60
Posted: 07/05/2004, 10:14 PM

I used codecharge to generate a quick login page to some other forms I have in my project. However, I can't seem to find the OnClick event for a button on the login screen.

I wrote a subroutine that moves to a specific page based on which user is logged in, but it never seems to work. It still redirects to the page I initially told it too, and my subroutine doesn't fire. I'm not even sure if I'm calling it in the right place. Where would I call it to? Or in other words, where is the Onclick event in the generated code?

Thanks!
View profile  Send private message
peterr


Posts: 5971
Posted: 07/06/2004, 1:05 AM

The OnClick event is generated in the code when you create such event for your page/form/button. If you created a Login page then such event is created automatically and you can find it by searching the code for "Button_DoLogin". A different way to navigate to your event code would be to select that button then in the Properties panel select the Events tab, expand the "OnClick" event and double-click on the "Login" action/code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
drpcken

Posts: 60
Posted: 07/06/2004, 6:51 AM

Ahhh Yes I found it after posting this, but wasn't sure if thats what I needed,t hanks for confirming.

I have another problem though, for some reason I get a

Value cannot be Null. Parameter name: url

error when I click my login button, but I'm unable to find a variable, or a parameter called 'url'

I don't remember changing any specifics in the code to cause this.
View profile  Send private message
peterr


Posts: 5971
Posted: 07/06/2004, 11:15 AM

Sorry I couldn't respond earlier. The error looks a bit strange to me and I'm not sure what could be causing it, but looks like a some parameter within one of your forms. It may be not on the login page but on the next page that is shown after you login, so please specifically check that page. You could also contact our support and later attach the page so that we could take a quick look.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
drpcken

Posts: 60
Posted: 07/06/2004, 10:04 PM

Hey THANKS for all your help. If i can ask another question I think I'll have this figured out. I found the event that handles the onClick for the button. Here's the code:

'Button Button_DoLogin OnClick Handler @3-9B7D7913  
  
    Protected Sub Login_Button_DoLogin(ByVal sender As Object, ByVal e As System.EventArgs)  
        Dim RedirectUrl As String = GetLoginRedirectUrl("", "")  
        Dim item As New LoginItem  
        LoginLoadItemFromRequest(item, True)  
        Dim ErrorFlag As Boolean = (LoginErrors.Count > 0)  
'End Button Button_DoLogin OnClick Handler  
  
'Button Button_DoLogin Event OnClick. Action Login @4-317F416C  
        If DBUtility.CheckUser(Loginlogin.Text,Loginpassword.Text) Then  
            If Not(HttpContext.Current.Request("ret_link") is Nothing) Then   
                If Not(HttpContext.Current.Request("ret_link")="") Then   
                Response.Redirect(HttpContext.Current.Request("ret_link"))  
                Else  
                ErrorFlag=True  
                LoginErrors.Add("","Login or Password is incorrect.")  
                End If  
            End If  
        Else  
            ErrorFlag=True  
            LoginErrors.Add("","Login or Password is incorrect.")  
        End If  
'End Button Button_DoLogin Event OnClick. Action Login

Right now when this is clicked, it takes me absolutely no where, but adds a '?' to the end of my url. Thats when I noticed this code: NOTE: I added the if statement that redirects based on the column of the sql table.

  
'Record Form Login GetRedirectUrl method @2-638D5BD9  
  
    Protected Function GetLoginRedirectUrl(ByVal redirect As String, ByVal removeList As String) As String  
        Dim parameters As New LinkParameterCollection()  
		  
		Dim cmdString as New String("select SECURITYTYPE from Z_User_Security where UserID= '" + Me.Loginlogin.text + "'")  
		Dim sqlUserType as String  
		  
		Dim sqlConn as New SqlClient.SqlConnection()  
		Dim sqlComm as New SqlClient.SqlCommand()  
		sqlConn.Connectionstring = "server=(local);uid=sa;pwd=fair2218;initial catalog=ifpa"  
		  
		With sqlComm  
			.CommandType = CommandType.Text  
			.CommandText = cmdString  
			.Connection = sqlConn  
		End With  
  
		sqlConn.Open()  
		sqlUserType = sqlComm.ExecuteScalar  
  
		If redirect = "" AND sqlUserType = "Admin" Then  
		redirect = "Admin_Maintenance.aspx"  
  
		ElseIf redirect = "" AND sqlUserType = "Accounting" Then  
		redirect = "Accounting.aspx"  
  
		ElseIf redirect = "" AND sqlUserType = "TeamLeader" Then  
		redirect = "teamleader.aspx"  
  
		ElseIf redirect = "" AND sqlUserType = "FuneralHom" Then  
		redirect = "funeralhom.aspx"  
  
		ElseIf redirect = "" AND sqlUserType = "Counselor" Then  
		redirect = "counselor.aspx"  
		End If  
  
		sqlConn.Close()	  
  
		Return redirect + "?" + parameters.ToString("None",removeList,ViewState)  
    End Function  
'End Record Form Login GetRedirectUrl method

But even with this, it still directs me to the same url, only with a ? at the end of it. Doesn't send me to the desired page. I know that the Return Redirect is making a string, but its not containint the appropriate URL. Am I missing something?

THANKS AGAIN! You've been a great help!

View profile  Send private message
drpcken

Posts: 60
Posted: 07/10/2004, 8:59 AM

:-D

Figured this one out, thanks for all your help!!!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.