473,657 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call OnSelectedIndex Changed??

Does somebody knows, if there's a way to call the OnSelectedIndex Changed method of the dropdownlist by myself?

Or does somebody knows a way, to raise the SelectedIndexCh anged Event of a dropdownlist?

tia
Martin
Nov 18 '05 #1
2 1913
Hi Martin,

You should be able to call the subroutine on your own as long as you pass
the parameters it expects.

Here's a way to do it on a button click:

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles Button1.Click
Dim earg As New EventArgs
Call DropDownList1_S electedIndexCha nged _
(DropDownList1, earg.Empty)
End Sub

Private Sub DropDownList1_S electedIndexCha nged _
(ByVal sender As Object, _
ByVal e As System.EventArg s) _
Handles DropDownList1.S electedIndexCha nged
Button1.Text = _
DropDownList1.S electedValue.To String
End Sub

<P>
<asp:DropDownLi st id="DropDownLis t1" runat="server">
<asp:ListItem Value="Red">Red </asp:ListItem>
<asp:ListItem Value="Green">G reen</asp:ListItem>
<asp:ListItem Value="Blue">Bl ue</asp:ListItem>
</asp:DropDownLis t></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>

Is this what you meant?

Ken
Microsoft MVP [ASP.NET]
Toronto
"Martin" <Ma****@discuss ions.microsoft. com> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
Does somebody knows, if there's a way to call the OnSelectedIndex Changed
method of the dropdownlist by myself?

Or does somebody knows a way, to raise the SelectedIndexCh anged Event of a
dropdownlist?

tia
Martin


Nov 18 '05 #2
Thx for the reply but this is not what I mean, the problem is much more complicated.
I have the object of the dropdownlist, but I don't know how the eventhandler is called.

I am in a class outside of the page of the dropdownlist !

"Ken Cox [Microsoft MVP]" wrote:
Hi Martin,

You should be able to call the subroutine on your own as long as you pass
the parameters it expects.

Here's a way to do it on a button click:

Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles Button1.Click
Dim earg As New EventArgs
Call DropDownList1_S electedIndexCha nged _
(DropDownList1, earg.Empty)
End Sub

Private Sub DropDownList1_S electedIndexCha nged _
(ByVal sender As Object, _
ByVal e As System.EventArg s) _
Handles DropDownList1.S electedIndexCha nged
Button1.Text = _
DropDownList1.S electedValue.To String
End Sub

<P>
<asp:DropDownLi st id="DropDownLis t1" runat="server">
<asp:ListItem Value="Red">Red </asp:ListItem>
<asp:ListItem Value="Green">G reen</asp:ListItem>
<asp:ListItem Value="Blue">Bl ue</asp:ListItem>
</asp:DropDownLis t></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>

Is this what you meant?

Ken
Microsoft MVP [ASP.NET]
Toronto
"Martin" <Ma****@discuss ions.microsoft. com> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
Does somebody knows, if there's a way to call the OnSelectedIndex Changed
method of the dropdownlist by myself?

Or does somebody knows a way, to raise the SelectedIndexCh anged Event of a
dropdownlist?

tia
Martin


Nov 18 '05 #3

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

Similar topics

0
1490
by: Jon Maz | last post by:
Hi, I have a user control which contains a DropDownList, and I want to be able to set the OnSelectedIndexChanged method of the DDL in the User Control from the holding aspx page. Depending on which aspx page is holding the user control, the name of the method to be called when this event fires is different, so I want to pass the name of the method to the DDL via a public property of the User Control.
6
7731
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and update the database. Here is the control containment hierarchy: ASP Page Static User Control // just provides a pretty border around
6
2051
by: srallen | last post by:
I have a simple page that has a dropdown with autopostback=true and onselectedindexchanged is set to a function that never gets called (checked during debug). This page is subclassed from custom class of mine that I subclassed from Page. I have overridden a couple of methods (OnPreRender, OnUnload, OnInit) to provide for html template layout, all of the base functions are called as well. Can anyone lend some help as to why the...
1
5061
by: RedGST | last post by:
Hello, Im somewhat new to asp.net, so bear with me. I have created a form that has a Listbox along with 2 command buttons & a few other non-important controls. The command button is tied to the OnClick Event. My problem is that when the command button is clicked, the Listbox OnSelectedIndexChanged event gets fired before the command buttons OnClick
6
2390
by: Olivier Matrot | last post by:
Hello, This has probably been asked several times, but It must be clarified for me. I would like to know why sometimes during a postback Page_Load is called after the function marked for postback. Here's the deal : From now on, I set CurrentThread.CurrentCulture only during PageLoad. so date and currency format is incorrect if page load is not called first. What should I do to ensure that CurrentThread.CurrentCulture is alway set...
0
1710
by: Bengt-Erik Eliasson | last post by:
Hi! In a DataGrid I have a 'Add New'-field in the footer. I want to hide an control (txtNewFe_name) if the value of cmbNewFe_num is >0. How do I do that? The OnSelectedIndexChanged does not seem to response to anything, even though I tryed with just: Function CheckFe_num() Response.Write("Hello World!") End Function
0
939
by: Bengt-Erik Eliasson | last post by:
Hi! In a DataGrid I have a 'Add New'-field in the footer. I want to hide an control (txtNewFe_name) if the value of cmbNewFe_num is >0. How do I do that? The OnSelectedIndexChanged does not seem to response to anything, even though I tryed with just: Function CheckFe_num() Response.Write("Hello World!")
2
16084
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine in my asp tag as shown here: <asp:DropDownList id="ddlTo" runat="server"
1
1861
by: Groove | last post by:
I have a strange problem. It seems that for some reason, a OnSelectedIndexChanged event is no producing an error in IE6. What concerns me is that I just performed that large Windows update a couple of weeks ago and it updated ActiveX "stuff" in IE. I'm not sure if the update has effected IE or there's something wrong with mt .net application. I have a simple DDL. It calls a sub when the value in the DDL is changed. Now, when I change...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.