473,326 Members | 2,111 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,326 software developers and data experts.

button click problem

Hi,

I have a code like this:

protected void Page_Load(object sender, EventArgs e)
{
// CODE1
}

protected void Button_Click(object sender, EventArgs e)
{
// CODE2
}

I was noticed that when I click the button, CODE1 executea and after
that CODE2 executes.
Here is the problem, I dont want to execute CODE1 but only CODE2 [and
I dont want to use isPostBack].
Is there anyway to do this? I thik that the best way is getting name
or id of the clicked button.

bye

Feb 9 '08 #1
3 965


"la*****@gmail.com" <la*****@gmail.comwrote in message
news:e9**********************************@c23g2000 hsa.googlegroups.com:
Hi,

I have a code like this:

protected void Page_Load(object sender, EventArgs e)
{
// CODE1
}

protected void Button_Click(object sender, EventArgs e)
{
// CODE2
}

I was noticed that when I click the button, CODE1 executea and after
that CODE2 executes.
Here is the problem, I dont want to execute CODE1 but only CODE2 [and
I dont want to use isPostBack].
But that's the way it works. In Page_Load, you use IsPostBack to
determine why you are there - is the page being loaded or did someone
click the button.
Is there anyway to do this? I thik that the best way is getting name
or id of the clicked button.

bye
Feb 9 '08 #2
Peter Bromberg has an article that may help you:

ASP.NET: Which Control Posted Back?
http://www.eggheadcafe.com/articles/20050609.asp

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<la*****@gmail.comwrote in message
news:e9**********************************@c23g2000 hsa.googlegroups.com...
Hi,

I have a code like this:

protected void Page_Load(object sender, EventArgs e)
{
// CODE1
}

protected void Button_Click(object sender, EventArgs e)
{
// CODE2
}

I was noticed that when I click the button, CODE1 executea and after
that CODE2 executes.
Here is the problem, I dont want to execute CODE1 but only CODE2 [and
I dont want to use isPostBack].
Is there anyway to do this? I thik that the best way is getting name
or id of the clicked button.

bye

Feb 10 '08 #3
Programming for the web requires a paradigm-shift compared to
programming for windows.

I suggest you go back to basics to get an overview as to what is
happening.

Perhaps if you go to Help and look for 'ASP.NET Page Life Cycle
Overview' and follow it through, you will get the idea.

"la*****@gmail.com" <la*****@gmail.comwrote in message
news:e9**********************************@c23g2000 hsa.googlegroups.com:
Hi,

I have a code like this:

protected void Page_Load(object sender, EventArgs e)
{
// CODE1
}

protected void Button_Click(object sender, EventArgs e)
{
// CODE2
}

I was noticed that when I click the button, CODE1 executea and after
that CODE2 executes.
Here is the problem, I dont want to execute CODE1 but only CODE2 [and
I dont want to use isPostBack].
Is there anyway to do this? I thik that the best way is getting name
or id of the clicked button.

bye
Feb 10 '08 #4

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

Similar topics

3
by: Jason Kyle Baginski | last post by:
Here's a little test app to demonstrate a problem I'm having. It creates four buttons, each one with the different FlatStyle types available. Three of them behave exactly the same way(and the...
6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
4
by: John Smith Jr. | last post by:
I have a very strange problem, I am dynamically creating buttons and events, when page loads the first click works fine, every click there after the event only fires every other click. I made a...
4
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
1
by: Klaus Jensen | last post by:
Hi! This has been annoying me all day, and I can't get it to work It is really driving me nuts! Basicly this simple webapp created to illustrate my problem, renders five buttons, and adds a...
7
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently...
9
by: mosscliffe | last post by:
I am sorry but I am all very new and slow at understanding all this ASP.NET2. I found some code which showed how to page with a repeater. All very excited as I had been looking for this all...
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
9
by: Jonathan Wood | last post by:
Does anyone know of any reason a button on a master page would have no effect? I have a complex HTML page that I'm converting to ASP.NET, and acknowledge I could have something odd that is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.