all groups > asp.net > january 2008 >
You're in the

asp.net

group:

code behind issue


code behind issue solutionsdxb@gmail.com
1/31/2008 10:54:20 PM
asp.net:
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.

RE: code behind issue Phil Johnson
2/1/2008 5:49:00 AM
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


[quoted text, click to view]
Re: code behind issue solutionsdxb@gmail.com
2/5/2008 12:22:19 AM
On Feb 1, 6:49 pm, Phil Johnson
[quoted text, click to view]

Since i am not much experience in asp.net , could you please tell me
how to find out
[quoted text, click to view]

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

Re: code behind issue Phil Johnson
2/5/2008 1:10:01 AM
No problem,

In your original message you wrote....

[quoted text, click to view]

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


[quoted text, click to view]
Re: code behind issue solutionsdxb@gmail.com
2/5/2008 4:00:57 AM
On Feb 5, 2:10 pm, Phil Johnson
[quoted text, click to view]

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

AddThis Social Bookmark Button