473,326 Members | 2,128 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.

Control and Postbacks?

I have two dropdownList controls with AutoPostBack property set to
"True". Everything works fine but I need to find out at the Page_Load
Postback event which dropdownlist control posted the form? Is this
possible with ASP.Net? I searched on the web for this without any
luck.

Any help will be appreciated..

Thanks!
Nov 20 '05 #1
9 995

On thing you could try is to have a function that runs your 'page load' code
and have it called from the 'SelectedIndexChanged' event on the dropdown.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

' Do nothing.

End Sub

Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged

Response.Write("DD 1 Called!")

Call MyPageLoad(sender, e)

End Sub

Private Sub DropDownList2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList2.SelectedIndexChanged

Response.Write("DD 2 Called!")

Call MyPageLoad(sender, e)

End Sub

Private Sub MyPageLoad(ByVal sender As System.Object, ByVal e As
System.EventArgs)

' Handle page loading stuff

End Sub

- Paul Duncan

"Noor" <no**********@hotmail.com> wrote in message
news:bc**************************@posting.google.c om...
I have two dropdownList controls with AutoPostBack property set to
"True". Everything works fine but I need to find out at the Page_Load
Postback event which dropdownlist control posted the form? Is this
possible with ASP.Net? I searched on the web for this without any
luck.

Any help will be appreciated..

Thanks!

Nov 20 '05 #2
wait... why would you want to? The first thing that will fire is the
SelectedIndexChnaged Event for that... and then the Page_Load will fire...
so, you could set something in the selected index changed event, but I don't
know why you would want to.

-CJ
"Noor" <no**********@hotmail.com> wrote in message
news:bc**************************@posting.google.c om...
I have two dropdownList controls with AutoPostBack property set to
"True". Everything works fine but I need to find out at the Page_Load
Postback event which dropdownlist control posted the form? Is this
possible with ASP.Net? I searched on the web for this without any
luck.

Any help will be appreciated..

Thanks!

Nov 20 '05 #3
Actually, from my test, it looks like the page_load is fired first.

- P
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
wait... why would you want to? The first thing that will fire is the
SelectedIndexChnaged Event for that... and then the Page_Load will fire...
so, you could set something in the selected index changed event, but I don't know why you would want to.

-CJ
"Noor" <no**********@hotmail.com> wrote in message
news:bc**************************@posting.google.c om...
I have two dropdownList controls with AutoPostBack property set to
"True". Everything works fine but I need to find out at the Page_Load
Postback event which dropdownlist control posted the form? Is this
possible with ASP.Net? I searched on the web for this without any
luck.

Any help will be appreciated..

Thanks!


Nov 20 '05 #4
Cor
Hi CJ,

I can be wrong of course, but I never saw something else than the pageload
always fires first with a webform

:-)

Cor
wait... why would you want to? The first thing that will fire is the
SelectedIndexChnaged Event for that... and then the Page_Load will fire...
so, you could set something in the selected index changed event, but I don't know why you would want to.

Nov 20 '05 #5
My bad.. had it backwards... apologies...

-CJ

"Cor" <no*@non.com> wrote in message
news:Oj**************@TK2MSFTNGP10.phx.gbl...
Hi CJ,

I can be wrong of course, but I never saw something else than the pageload
always fires first with a webform

:-)

Cor
wait... why would you want to? The first thing that will fire is the
SelectedIndexChnaged Event for that... and then the Page_Load will fire... so, you could set something in the selected index changed event, but I

don't
know why you would want to.


Nov 20 '05 #6
Cor
Hi CJ,

I only had fun that I saw that you probebly did not see that it was a
webform.And therefore I putted webform on the end..

:-)))

Was a ) to few.

Cor
Nov 20 '05 #7
Well I still need the original Page_Load because I have few other
controls in .aspx page beside the dropdownlist controls that I process
in it. I have some other biz logic in the Page_Load event that get
process when Page.isPostback is true.

I don't know if it is possible with ASP.net but easiest thing for me
would be to check which DD list control posted the page.

Once again thanks for the help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #8
Any more suggestions or idea regarding this???
Noor Khimani <no**********@hotmail.com> wrote in message news:<#U*************@tk2msftngp13.phx.gbl>...
Well I still need the original Page_Load because I have few other
controls in .aspx page beside the dropdownlist controls that I process
in it. I have some other biz logic in the Page_Load event that get
process when Page.isPostback is true.

I don't know if it is possible with ASP.net but easiest thing for me
would be to check which DD list control posted the page.

Once again thanks for the help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #9
Cor
Hi Noor,

psuedo code
\\\
load event
if not Is postback then
this is the first time
else
this is every time there is a postback
end if
end sub
dropdownlist1 event
this comes after that load event when dropdownlist1 send
end sub
dropdownlist2 event
this comes after that load event when dropdownlist2 send
end sub
//
I hope this makes it a little bit more clear?

Cor
Nov 20 '05 #10

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

Similar topics

1
by: Maruthi | last post by:
Hi, I just wanted to discuss about the wierd behavior of placeholder control. Let me explain the scenario first. We are building an online loan origination system using ASP.NET. On a web form we...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
3
by: Guadala Harry | last post by:
I have a simple user control (see below) that has EnableViewState="true". I place it on an ASPX page at runtime using a PlaceHolder - which also has EnableViewState="true". After a postback, the...
3
by: Benjamin Gavin | last post by:
Hi all, I recently stumbled upon a bug in the ASP.NET framework handling of ImageButton based postbacks. The issues derives from the fact that IE and Mozilla handle the case of a missing image...
3
by: Martin | last post by:
Hi, I have created a composite control that has a number of standard asp.net controls on it that can themselves cause postbacks. What i need to do in my composite control is to determine which...
2
by: rn5a | last post by:
Assume that a user control has a TextBox (Page1.ascx) <asp:TextBox ID="txtName" runat="server"/> I am encapsulating the above user control in a ASPX page named Page1.aspx i.e. the ASPX page...
2
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and...
1
by: Nathan Sokalski | last post by:
As we all know, the Calendar control causes postbacks that we often do not want. This will obviously cause the Page's Load event to be triggered. I have code in my Load event that I want executed...
4
by: Nathan Sokalski | last post by:
I have 2 private variables in my class that I need to remember the values of between postbacks (or actually callbacks, since I am using AJAX). I want to avoid using session variables, if possible....
2
by: Peter | last post by:
Hi all The following code only work for the first click, if i click the image button second time, it doesn't add a control dynamically. How to fix? Protected Sub ImageButton1_Click(ByVal...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.