473,409 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

c# & autoeventwireup

Hi all,

So I set autoeventwireup=false in my aspx page. Now for some reason the
method below doesnt get executed. How do I get it to execute?

public partial class App_Fees_list_fees : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

InitControls();

}

protected void InitControls()

{

string[] keys = new string[1];

keys[0] = "feeid";

list.DataKeyNames = keys;

list.EmptyDataText = "Sorry, no fees were found in the database.";

pnl_list.Visible = true;

//pnl_details.Visible = false;

LoadData();

}

}

TIA!
Dec 7 '06 #1
3 3844
The "some reason" would be that you set autoeventwireup=false.

You have to manually attach the handler for the Load event to the Page_Load
routine now that it's not being automatically done for you.

<pa***@community.nospamwrote in message
news:O4**************@TK2MSFTNGP05.phx.gbl...
Hi all,

So I set autoeventwireup=false in my aspx page. Now for some reason the
method below doesnt get executed. How do I get it to execute?

public partial class App_Fees_list_fees : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

InitControls();

}

protected void InitControls()

{

string[] keys = new string[1];

keys[0] = "feeid";

list.DataKeyNames = keys;

list.EmptyDataText = "Sorry, no fees were found in the database.";

pnl_list.Visible = true;

//pnl_details.Visible = false;

LoadData();

}

}

TIA!


Dec 7 '06 #2
How do I manually attach the handler for the Load event? It would be nice if
you can provide some code samples and where to put it in the code behind
page?

TIA!

"Marina Levit [MVP]" <so*****@nospam.comwrote in message
news:eQ*************@TK2MSFTNGP02.phx.gbl...
The "some reason" would be that you set autoeventwireup=false.

You have to manually attach the handler for the Load event to the
Page_Load routine now that it's not being automatically done for you.

<pa***@community.nospamwrote in message
news:O4**************@TK2MSFTNGP05.phx.gbl...
>Hi all,

So I set autoeventwireup=false in my aspx page. Now for some reason the
method below doesnt get executed. How do I get it to execute?

public partial class App_Fees_list_fees : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

InitControls();

}

protected void InitControls()

{

string[] keys = new string[1];

keys[0] = "feeid";

list.DataKeyNames = keys;

list.EmptyDataText = "Sorry, no fees were found in the database.";

pnl_list.Visible = true;

//pnl_details.Visible = false;

LoadData();

}

}

TIA!



Dec 7 '06 #3
Thanks for Brians's input.

Hi Param,

for your case here, if turning on "autoeventwireup" is no possible, you can
programmatically regsiter the page's event handlers in constructor. e.g.

=======================

public partial class App_Fees_list_fees : System.Web.UI.Page

{

public App_Fees_list_fees()
{
this.Load += new EventHandler(Page_Load);
}
protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

InitControls();

}
====================

If you have other event handlers for the page's events, you need to
manually register them also.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Guy Lafleur | last post by:
I have a user control that builds a treeview dynamically in the Page_Load event. Also, I have the AutoEventWireup property set to true (i.e., <%@ Control AutoEventWireup="true" %>). Then, when I...
1
by: Horace | last post by:
Hello Does anyone know how to remove (or make more general) both the Imports clause (in a class .vb file) and the Page directive (specifically the Inherits clause in a web page .aspx file). ...
1
by: prem | last post by:
Hi , Any one please give me the Usage with example for AutoEventWireUp PageDirective. Regards, Prem.
5
by: Juan T. Llibre | last post by:
OK, guys, usually I answer questions instead of asking them, but this thing has me scratching my head. Why is the default for AutoEventWireup different for C# and VB.NET ? In VS 2005, if I...
28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
3
by: Jeff | last post by:
Hey! ASP.NET 2.0 I have a webpage which is based on a nested master page. The problem is that I've applied a theme to the webpage but the CSS settings isn't applied to the panes.... As you...
4
by: john_c | last post by:
When I add a new aspx page to my project, I don't see Init() or InitializeComponent() in any of the page's CS files. Where are the methods stored? Thanks.
0
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS...
1
by: mistryman06 | last post by:
Hi, I'm new to the ASP.NET Ajax. Im struck with an issue. Im having a tabcontainer with 3 tabs. Each tab has a user control (all 3 tab has the same user control) & the user control has a Button &...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.