still puzzled

D

Daniel

I double click on the dropdownlist box and see the code goes into that
selected_index event of the dropdownlist. And it still not fire up.

Thanks
 
G

Guest

See if the Sub Routine is wired to the Event (at the end of the Procedure Declaration you should see a Handles Clause. See if this is pointing to the correct Control

HT

Trevor Benedict
MCSD
 
D

Daniel

Yes, i do

Public Sub cboProReference_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboProReference.SelectedIndexChanged

......

and i still make the autopostback="true"
OnSelectedIndexChanged="cboProReference_SelectedIndexChanged"








Trevor Benedict R said:
See if the Sub Routine is wired to the Event (at the end of the Procedure
Declaration you should see a Handles Clause. See if this is pointing to the
correct Control.
 
D

Daniel

Yes, i do

Public Sub cboProReference_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboProReference.SelectedIndexChanged

......

and i still make the autopostback="true"
OnSelectedIndexChanged="cboProReference_SelectedIndexChanged"
 
D

Daniel

Hi, Trevor
Do i need to Make this method initialized in the Initialize method of the
code behind page

Thank~



Trevor Benedict R said:
See if the Sub Routine is wired to the Event (at the end of the Procedure
Declaration you should see a Handles Clause. See if this is pointing to the
correct Control.
 
R

Raterus

you don't need this statement if you are using codebehind/handles
OnSelectedIndexChanged="cboProReference_SelectedIndexChanged"

or any other statements that reference codebehind methods like that. That is used when you use <script runat="server"> ... </script>
 
D

Daniel

Thanks, Raterus
Below is my dropdownlist:
<asp:dropdownlist id="cboProReference" style="Z-INDEX: 107; LEFT: 137px;
POSITION: absolute; TOP: 80px" tabIndex="1" runat="server" Font-Size="8pt"
Font-Names="Tahoma" Width="322px" AutoPostBack="True">
</asp:dropdownlist>
I erase the
OnSelectedIndexChanged="cboProReference_SelectedIndexChanged".
And the code behind is:
Private Sub cboProReference_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboProReference.SelectedIndexChanged

txtPCSProjectName.Text = ""

Dim strProtocol As String

strProtocol = cboProReference.SelectedItem.Text

'get the protocol name

Dim anArray() As String

anArray = strProtocol.Split("|"c)

strProtocol = anArray(0)

'go to the database to get the pcs_protocol_ref according to protocol_ref

Dim dl As New WebRandDataLayer

txtPCSProjectName.Text = dl.GetPCSForProtocol(strProtocol)

End Sub

The bad thing is that it is still not fire up. Is anyother possible problem
here?

Thanks again!



you don't need this statement if you are using codebehind/handles
OnSelectedIndexChanged="cboProReference_SelectedIndexChanged"

or any other statements that reference codebehind methods like that. That
is used when you use <script runat="server"> ... </script>
 
D

Daniel

unfortunately it does not go there either!


Bin Song said:
Can you just try the following:

Private Sub cboProReference_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboProReference.SelectedIndexChanged
 
D

Daniel

I found another place has:

cboProReference.Attributes.Add("onchange", "SetHidProtocol();")

Does it affect the code behind to fire up?

~thanks




Bin Song said:
Can you just try the following:

Private Sub cboProReference_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboProReference.SelectedIndexChanged
 
B

bloomfield

Daniel said:
I found another place has:

cboProReference.Attributes.Add("onchange", "SetHidProtocol();")

Does it affect the code behind to fire up?

Yes it does :)

Just comment the line and see for yourself what is generated in the html
on the client. The asp.net engine automaticaly generates some code there
to do the postback. Then add the cboProReference.Attributes.Add("...
line again and see again the generated html. My guess is that you will
see two onchange attributes for the 'select' that is generated on the
client.
 
S

Steven Cheng[MSFT]

Hi Daniel,

I'm viewing the thread and found it is discussing the same problem with
another one titled:
Subject: cannot fire up dropdownlist's SelectedIndexChanged

I've posted my reply in that one and I'd appreciate if you have a look
there. Also, if you feel it convenient that we continue to discuss in that
thread, please feel free to post there. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top