Click here to Skip to main content
15,891,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want item template dropdown control event in code behind. I have loaded dataset values into item template dropdown control . I will change text in item template dropdown control in grid view at that time. I want some action in web page.

Thanks in Advance.
Posted
Updated 16-Dec-10 19:38pm
v2
Comments
Abdul Quader Mamun 17-Dec-10 1:38am    
Where is the code that you have tried?
Ankur\m/ 17-Dec-10 2:15am    
Do you mean selecting/changing a value in dropdownlist should trigger some action?
Sandeep Mewara 17-Dec-10 3:44am    
'I want' is ok. What have you tried?

1 solution

Although its not clear what are you trying to express, but here are some tips that might help you. If you want the action to be taken on the server side, at the time when you are binding the dropdown, you can add/attach the event to the dropdown & set the dropdown property AutoPostBack to true.
VB
--------------
DropDownList.AutoPostBack = True
AddHandler DropDownList.SelectedIndexChanged, AddressOf DropDownList_SelectedIndexChanged
--------------
Protected Sub DropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
 .. your code ..
End Sub

If you want the action to be taken on client side, at the time when you are binding the dropdown, use the attribute "onchange" property of the dropdown to add the client side script.
DropDownList.Attributes("OnChange") = "javascript: doSomething();"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900