code behind issue

  • Thread starter Thread starter solutionsdxb
  • Start date Start date
S

solutionsdxb

Hi ,

I am using a code behind for asp.net page ,

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

and file default.aspx.vb contains all the code including

Sub Page_Load()

If Request.QueryString("check") = "p" Then
'1. Create a connection

Dim tempemail As String
tempemail = User.Identity.Name
Me.rptrExample.EnableViewState = "True"
Me.rptrExample.Visible = "True"

Dim objConn As New
Data.SqlClient.SqlConnection(strConnString)
Dim strSQL As String
strSQL = "SELECT ufname,ulname,udate,uid FROM users where
uemail='" & tempemail & "'"
Dim objCmd As New Data.SqlClient.SqlCommand(strSQL,
objConn)

Try
objCmd.Connection.Open()

rptrExample.DataSource = objCmd.ExecuteReader()

rptrExample.DataBind()

objCmd.Connection.Close()
objCmd.Connection.Dispose()

Catch ex As Exception
lblStatus.Text = ex.Message
End Try


End sub


rptrexample is a repeater control but does not display anything and
not even the label display any message or error , so is it because i
am using code behind the request query string does not work, kindly
suggest.

Regards
 
You have the autoeventwirup set to false in the page directive.

For that you will need to add the event handlers yourself, which they might
not be.

Try changing the autoeventwireup to true and seeing if the event fires.

Also, put a breakpoint in the method right at the top, just to see if it is
running.
--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
 
You have the autoeventwirup set to false in the page directive.

For that you will need to add the event handlers yourself, which they might
not be.

Try changing the autoeventwireup to true and seeing if the event fires.

Also, put a breakpoint in the method right at the top, just to see if it is
running.
--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Developmentwww.pjsoftwaredevelopment.com

Since i am not much experience in asp.net , could you please tell me
how to find out
Since i am not much experience in asp.net , could you please tell me
how to find out or use the code you suggest

Regards
 
No problem,

In your original message you wrote....

This will be right at the top of your Default.aspx page (not the code behind).

Where it says... AutoEventWireup="false", try setting that to
AutoEventWireup="true"

To see if your event is running, in Visual Studio add a breakpoint in it.
So in the code behind file (Default.aspx.vb) right click the following line:

If Request.QueryString("check") = "p" Then

and select to insert a breakpoint, which should highlight the line in a
brownish red.

Now press F5 to start the application with debugging... you may be prompted
to set debugging to true if you havent ran in debug mode before.. if so just
click Yes.

The code should 'break' at the point where you set the breakpoint and it
should highlight that line of code in yellow. If it does then your Page_Load
event is firing. If it doesn't and the page loads without hitting the
breakpoint, then the event isn't wired up.


--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
 
No problem,

In your original message you wrote....


This will be right at the top of your Default.aspx page (not the code behind).

Where it says... AutoEventWireup="false", try setting that to
AutoEventWireup="true"

To see if your event is running, in Visual Studio add a breakpoint in it.
So in the code behind file (Default.aspx.vb) right click the following line:

If Request.QueryString("check") = "p" Then

and select to insert a breakpoint, which should highlight the line in a
brownish red.

Now press F5 to start the application with debugging... you may be prompted
to set debugging to true if you havent ran in debug mode before.. if so just
click Yes.

The code should 'break' at the point where you set the breakpoint and it
should highlight that line of code in yellow. If it does then your Page_Load
event is firing. If it doesn't and the page loads without hitting the
breakpoint, then the event isn't wired up.

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Developmentwww.pjsoftwaredevelopment.com

Thanks !!! , great it worked ...i appreciate

regards
 
Back
Top