Hello,
I'm starting with asp.net and i don't know how to raise the
SelectedIndexCh ange event when clicking in a dropdownlist control.
I thought it was the same as by clicking on a button.
This is what i did:
<asp:DropDownLi st ID="DropDownLis t1" runat="server">
</asp:DropDownLis t>
In the code-behind:
Protected Sub DropDownList1_S electedIndexCha nged(ByVal sender As Object,
ByVal e As System.EventArg s) Handles DropDownList1.S electedIndexCha nged
response.write( "test ok")
end sub
But nothing happens when clicking in the dropdownlist.
I probably miss some code ...
Any help woul be appreciated
Dave 2 2886
you can do that in two ways: the simplest ( using the Design View )
click one time in the DropDownList, in Properties Window there is a
orange lighting icon (Events), click it
then you can see what events can you add to that components (in this
case the DropDownList)
to add a event click twice in one of then...
writting code ( using the Code View )
your code is actualy almost done, except that you miss one important
thing and one less important but for what you wan to do, extermelly
important.
your code is:
<asp:DropDownLi st ID="DropDownLis t1" runat="server"> </asp:DropDownLis t>
as you can see, you are not telling the component to do anything! so you
need to tell him that you want to perform a function and if you want to
perform such function everytime you change the options in the DropDown you
need to tell him to perform an autopostbask, so the correct code will be
like this:
<asp:DropDownLi st ID="DropDownLis t1" runat="server" AutoPostBack="t rue"
OnSelectIndexCh ange="DropDownL ist1_SelectedIn dexChanged"></asp:DropDownLis t>
you can remove the Handles DropDownList1.S electedIndexCha nged from the
function if you add the OnSelectIndexCh ange, or keep it and remove the event
from the ddl compont
hope that helps.
--
Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Dave" <xc*@sdv.sdv> escreveu na mensagem
news:O8******** ********@TK2MSF TNGP03.phx.gbl. .. Hello,
I'm starting with asp.net and i don't know how to raise the SelectedIndexCh ange event when clicking in a dropdownlist control. I thought it was the same as by clicking on a button.
This is what i did: <asp:DropDownLi st ID="DropDownLis t1" runat="server"> </asp:DropDownLis t>
In the code-behind: Protected Sub DropDownList1_S electedIndexCha nged(ByVal sender As Object, ByVal e As System.EventArg s) Handles DropDownList1.S electedIndexCha nged response.write( "test ok") end sub
But nothing happens when clicking in the dropdownlist. I probably miss some code ...
Any help woul be appreciated Dave
Thanks for replying, but my mistake was that the option "autopostba ck" was
set on "off" in the properties. I changed it to "on" and it works ...
"Bruno Alexandre" <br*********@gm ail.com> wrote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l... you can do that in two ways:
the simplest ( using the Design View ) click one time in the DropDownList, in Properties Window there is a orange lighting icon (Events), click it then you can see what events can you add to that components (in this case the DropDownList) to add a event click twice in one of then...
writting code ( using the Code View ) your code is actualy almost done, except that you miss one important thing and one less important but for what you wan to do, extermelly important.
your code is: <asp:DropDownLi st ID="DropDownLis t1" runat="server"> </asp:DropDownLis t>
as you can see, you are not telling the component to do anything! so you need to tell him that you want to perform a function and if you want to perform such function everytime you change the options in the DropDown you need to tell him to perform an autopostbask, so the correct code will be like this:
<asp:DropDownLi st ID="DropDownLis t1" runat="server" AutoPostBack="t rue"
OnSelectIndexCh ange="DropDownL ist1_SelectedIn dexChanged"></asp:DropDownLis t> you can remove the Handles DropDownList1.S electedIndexCha nged from the function if you add the OnSelectIndexCh ange, or keep it and remove the
event from the ddl compont
hope that helps.
--
Bruno Alexandre (a Portuguese in Københanv, Danmark)
"Dave" <xc*@sdv.sdv> escreveu na mensagem news:O8******** ********@TK2MSF TNGP03.phx.gbl. .. Hello,
I'm starting with asp.net and i don't know how to raise the SelectedIndexCh ange event when clicking in a dropdownlist control. I thought it was the same as by clicking on a button.
This is what i did: <asp:DropDownLi st ID="DropDownLis t1" runat="server"> </asp:DropDownLis t>
In the code-behind: Protected Sub DropDownList1_S electedIndexCha nged(ByVal sender As Object, ByVal e As System.EventArg s) Handles DropDownList1.S electedIndexCha nged response.write( "test ok") end sub
But nothing happens when clicking in the dropdownlist. I probably miss some code ...
Any help woul be appreciated Dave
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Cimpoiesu |
last post by:
I have a remoting object, derived from MarshalByRefComponent, that I
instantiate on the client side, with Activator.GetObject.
Can I receive events fired on the server, on the client?
How?
|
by: Thorben |
last post by:
Hello,
how can I undo/cancel the SelectedIndexChange event of an Listview control?
Thanks in advance
Thorben
|
by: Paul C |
last post by:
Can anyone tell me why I am getting 2 calls to my SelectedIndexChange
event.
public class Browse : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.DropDownList DropDownConf;
protected DataSet BrowseOrders=null;
|
by: Jay |
last post by:
I have dropdownlist in a usercontrol and selectedindexchange event captured.
But Iam seeing fire twice.
Thanks.
|
by: MBhat |
last post by:
Hello,
I have a dropdownlist server control.On selectedIndexChange I do some
functionality. In addtion to this I need to check for something else. To
do this I have to use javascript function to display confirmation alert.
How can I use the javascript confirmation alert in code behind?
any help?
Thanks
| |
by: Vittorio Pavesi |
last post by:
Hello,
is it possible to manually raise the event Elapsed of the timer object ?
Vittorio
|
by: Leonardo Santos-Macias |
last post by:
I have a dropdown list that I bind at runtime. It does postback to the
server. If I select any item, it will trigger the SelectedIndexChange event.
My problem is that it doesn't trigger the SelectedIndexChange event when I
select the first item (index=0)... any ideas?
The dropdown lives in a custom control
|
by: =?Utf-8?B?Ulc=?= |
last post by:
I constructed a new Class with some private members.
I would like an event to be raised on the moment the value of one of those
private members is changed.
How do I define an event for that private member and how do I raise the event?
--
RW
|
by: Mike |
last post by:
Hi group;
Let say I have an object called Account, that raises an event called
AccountLow with its owns EventArgs, and when this event gets raised, I
will like to raise another custom event called AccountGotLowAmount and
passes AccountLow’s EventArgs along with the new event.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |