473,378 Members | 1,372 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,378 software developers and data experts.

Runtime SelectedIndexChanged!

Hi all,

I have a DropDownList that i want to attach a OnSelectedIndexChange event
Dynamically.
So far my attempts have failed.

'determine if report being generated is a 'Question Statistics' report
If(ddlReportTypes.SelectedValue = "q") Then

'specify OnSelectedIndexChanged method Sub
'tried
ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions"
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions"

End If

Both options i have tried have generated errors?

Can anyone steer me in the right direction?

Adam

Nov 19 '05 #1
4 1937
Adam,

Do you mean you want something to happen clientside onSelectedIndexChanged?

If so then you need to attach a javascript to the control using it's
attributes method.

DropDownList.Attributes.Add("onSelectedIndexChange d", "your javascript
here")

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a DropDownList that i want to attach a OnSelectedIndexChange event
Dynamically.
So far my attempts have failed.

'determine if report being generated is a 'Question Statistics' report
If(ddlReportTypes.SelectedValue = "q") Then

'specify OnSelectedIndexChanged method Sub
'tried
ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions"
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions"

End If

Both options i have tried have generated errors?

Can anyone steer me in the right direction?

Adam

Nov 19 '05 #2
As Justin adviced..
Whats the DDL pointing too ?
What is LoadQuestions
Patrick

"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a DropDownList that i want to attach a OnSelectedIndexChange event
Dynamically.
So far my attempts have failed.

'determine if report being generated is a 'Question Statistics' report
If(ddlReportTypes.SelectedValue = "q") Then

'specify OnSelectedIndexChanged method Sub
'tried
ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions"
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions"

End If

Both options i have tried have generated errors?

Can anyone steer me in the right direction?

Adam

Nov 19 '05 #3
No not after javascript...

I am wanting to attach the OnSelectedIndexChanged (ASP.NET event for
DropDownList) Method dynamically to a DropDownList.

Both these options have failed.

ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions" \\call
LoadQuestions function onSelectedIndexChange //server side
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions" \\call
LoadQuestions function onSelectedIndexChange //server side

Cheers,
Adam

"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a DropDownList that i want to attach a OnSelectedIndexChange event
Dynamically.
So far my attempts have failed.

'determine if report being generated is a 'Question Statistics' report
If(ddlReportTypes.SelectedValue = "q") Then

'specify OnSelectedIndexChanged method Sub
'tried
ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions"
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions"

End If

Both options i have tried have generated errors?

Can anyone steer me in the right direction?

Adam

Nov 19 '05 #4
Adam,

The most common cause of this failing is that if the control is being added
to the page dynamically it has to be added again on post back. If the
control isn't recreated on post back then .NET never connects up the post
back event to the control and the event doesn't fire.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
No not after javascript...

I am wanting to attach the OnSelectedIndexChanged (ASP.NET event for
DropDownList) Method dynamically to a DropDownList.

Both these options have failed.

ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions" \\call
LoadQuestions function onSelectedIndexChange //server side
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions" \\call
LoadQuestions function onSelectedIndexChange //server side

Cheers,
Adam

"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:O8**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a DropDownList that i want to attach a OnSelectedIndexChange event
Dynamically.
So far my attempts have failed.

'determine if report being generated is a 'Question Statistics' report
If(ddlReportTypes.SelectedValue = "q") Then

'specify OnSelectedIndexChanged method Sub
'tried
ddlAssessmentAreas.SelectedIndexChanged = "LoadQuestions"
'and
ddlAssessmentAreas.OnSelectedIndexChanged = "LoadQuestions"

End If

Both options i have tried have generated errors?

Can anyone steer me in the right direction?

Adam


Nov 19 '05 #5

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

Similar topics

0
by: LV | last post by:
Hello, I would like to manually set one of my list view items as selected. When this item is set, I would like for a method to execute. I have a delegate on the list view for SelectedIndexChanged....
0
by: LV | last post by:
Hello, When I manually set a list view item to be a selected item, the SelectedIndexChanged event is not firing. Am I missing something here? using System; using System.Windows.Forms; ...
1
by: Donal | last post by:
I have 3 related dropdowns. When the 1st is changed, the 2nd is updated, and when the 2nd is changed, the 3rd is updated. When i change the 1st dropdown (sites), the SelectedIndexChanged fires...
0
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...
0
by: Steve Moreno | last post by:
Hi all, I've got a web form that I've written code to create an array of DropDownList controls on the page depending on how many records are pulled back. The code to create the controls is...
2
by: Jason Richmeier | last post by:
Perhaps it is because it is the end of the day and my eyes are tired of looking at code but I cannot seem to figure out what I am doing wrong and what I can do (if anything) to fix it. On a...
3
by: Alec MacLean | last post by:
Hi, I have a couple of win forms where I am editing values that are stored in a SQL database. I'm using the listbox control to hold the data object each form interacts with. Each object is...
4
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...
1
by: Payodhi | last post by:
At runtime I am binding value of a grid view.First & last columns are template column .Inside first column I have taken a Dropdownlist and last column I have text box.Remember everything I am doing...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.