code behind issue

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
 
P

Phil Johnson

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
 
S

solutionsdxb

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
 
P

Phil Johnson

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
 
S

solutionsdxb

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top