I have a DataGrid with only one TemplateColumn wich contains a DropDownList.
After I bind the DataGrid I fill the dropDownLists with values in
ItemDataBound. None of the DropDownLists contains the same values. Some of
these DropDownLists have AutoPostBack set to true, but I'm having trouble
adding the SelectedIndexCh anged event to them. This is my code:
ddlParameterVal ue = dataGridItem.Fi ndControl("ddlP arameterValue")
ddlParameterVal ue.AutoPostBack = True
AddHandler ddlParameterVal ue.SelectedInde xChanged, New
System.EventHan dler(AddressOf ddlParameterVal ue_SelectedInde xChanged)
Public Sub ddlParameterVal ue_SelectedInde xChanged(ByVal sender As Object,
ByVal e As System.EventArg s)
....
End Sub
I put a brakepoint on the method, but it never gets called. The
AutoPostBack part works fine.
Any ideas?
Shawn 3 3742
About this
Public Sub ddlParameterVal ue_SelectedInde xChanged(ByVal sender As
Object,ByVal e As System.EventArg s) DDL.SelectedInd exChanged
Patrick
"Shawn" <bo********@hot mail.com> wrote in message
news:#W******** ******@TK2MSFTN GP09.phx.gbl... I have a DataGrid with only one TemplateColumn wich contains a
DropDownList. After I bind the DataGrid I fill the dropDownLists with values in ItemDataBound. None of the DropDownLists contains the same values. Some
of these DropDownLists have AutoPostBack set to true, but I'm having trouble adding the SelectedIndexCh anged event to them. This is my code: ddlParameterVal ue = dataGridItem.Fi ndControl("ddlP arameterValue") ddlParameterVal ue.AutoPostBack = True AddHandler ddlParameterVal ue.SelectedInde xChanged, New System.EventHan dler(AddressOf ddlParameterVal ue_SelectedInde xChanged)
Public Sub ddlParameterVal ue_SelectedInde xChanged(ByVal sender As Object, ByVal e As System.EventArg s) ... End Sub
I put a brakepoint on the method, but it never gets called. The AutoPostBack part works fine.
Any ideas?
Shawn
Shawn wrote: I have a DataGrid with only one TemplateColumn wich contains a DropDownList. After I bind the DataGrid I fill the dropDownLists with values in ItemDataBound. None of the DropDownLists contains the same values. Some of these DropDownLists have AutoPostBack set to true, but I'm having trouble adding the SelectedIndexCh anged event to them. This is my code: ddlParameterVal ue = dataGridItem.Fi ndControl("ddlP arameterValue") ddlParameterVal ue.AutoPostBack = True AddHandler ddlParameterVal ue.SelectedInde xChanged, New System.EventHan dler(AddressOf ddlParameterVal ue_SelectedInde xChanged)
Public Sub ddlParameterVal ue_SelectedInde xChanged(ByVal sender As Object, ByVal e As System.EventArg s) ... End Sub
I put a brakepoint on the method, but it never gets called. The AutoPostBack part works fine.
Any ideas?
Shawn
Hi Shawn,
1) When are you adding the event handler,
2) Are other events working?
Even if the control exists already on the page, I believe you'd have to
make sure you add the handler during each page request (i.e. not just
the first time inside a If Not IsPostback block)
Damien
You were right, I had to add the handler during each page request.
"Damien" <Da************ *******@hotmail .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Shawn wrote: I have a DataGrid with only one TemplateColumn wich contains a
DropDownList. After I bind the DataGrid I fill the dropDownLists with values in ItemDataBound. None of the DropDownLists contains the same values. Some
of these DropDownLists have AutoPostBack set to true, but I'm having
trouble adding the SelectedIndexCh anged event to them. This is my code: ddlParameterVal ue = dataGridItem.Fi ndControl("ddlP arameterValue") ddlParameterVal ue.AutoPostBack = True AddHandler ddlParameterVal ue.SelectedInde xChanged, New System.EventHan dler(AddressOf ddlParameterVal ue_SelectedInde xChanged)
Public Sub ddlParameterVal ue_SelectedInde xChanged(ByVal sender As
Object, ByVal e As System.EventArg s) ... End Sub
I put a brakepoint on the method, but it never gets called. The AutoPostBack part works fine.
Any ideas?
Shawn
Hi Shawn,
1) When are you adding the event handler, 2) Are other events working?
Even if the control exists already on the page, I believe you'd have to make sure you add the handler during each page request (i.e. not just the first time inside a If Not IsPostback block)
Damien This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: PeacError |
last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1:
I apologize if this question has been addressed elsewhere, but I could not
find a reference to it in the search engine for this board.
I have a form that contains a ListView and a GroupBox control. The GroupBox
control itself contains several TextBox Controls. I have Validating and
Validated event handlers set for the GroupBox control, and a
SelectedIndexChanged event...
|
by: Dominic |
last post by:
Hi guys,
I'm not sure if this question belongs to FAQ, but I couldn't find a
concrete answer.
I created a Datagrid control using ItemTemplate, but it's NOT a
in-place editing datagrid. One of the columns of the data grid
contains a DropDownlist. I managed to create this datagrid control as
follows.
|
by: Brent Burkart |
last post by:
Has anyone experienced any problems with their selectedindexchanged not
firing when there are user controls present on the page? I have 4 controls
on a page and only once I remove all 4 does my dropdownbox
selectedindexchanged work.
Any ideas?
|
by: Edward |
last post by:
I am having a terrible time getting anything useful out of a listbox
on my web form.
I am populating it with the results from Postcode lookup software, and
it is showing the results fine. What I want to do is to allow the
user to click on the row that corresponds to the correct address, and
have the code behind populate the form's Address1, Address2 etc.
controls with the relevant data items.
I put the code for this into the...
|
by: CW |
last post by:
Yes, Autopostback is true, and it doesn't make an iota of difference at all.
HTML snippet and code (behind) snippet is as below:
<asp:dropdownlist id="ddlLoginType" runat="server" Width="163px"
AutoPostBack="True"></asp:dropdownlist>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| |
by: Jim |
last post by:
Hi All,
Can someone tell me why the SelectedIndexChanged event does not fire?
<form id="Form1" method="post" runat="server">
|
by: Chrysan |
last post by:
I have a popup window, which consist of 2 combobox. The second
combobox's(cboCube) item collection will change based on the first
combobox's(cboDatabase) event(selectedindex_changed) is fired. And, I do have
write such code in code-behind as follow:
Private Sub cboDatabase_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboDatabase.SelectedIndexChanged
Dim strAdomdConnectionString As String
Try
|
by: j_stus |
last post by:
Hello there
I was trying to find something about this on web but with no success.
I am using code behind.
Basically I am creating drop down list dynamically.
Everything works but calling SelectedIndexChanged event never fires up.
I found some discussions regarding this problem, but couldn't find
answer....
Here is my code.
Protected WithEvents ddl As System.Web.UI.WebControls.DropDownList
|
by: lakepeir |
last post by:
Hello,
I have combobox with a selectedindexchanged method that seems to be
called when starting the application, launching the form with the
combobox and making a change in the drop down box of the combobox. Can
anyone tell me why the method is called so often? I would only like
the method executed when a user makes a change in the drop down box.
Am I using the incorrect method. Thanks.
|
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: 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...
|
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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |