selectedIndexChanged

  • Thread starter Thread starter Selen
  • Start date Start date
Hi

I had this problem so try this try adding a please select entry to the
DropDownList. I found that if the user selected the first entry in the ddl
it obviously nver called the SelectIndexChanged event

Client



private void AvailableClasses_SelectedIndexChanged(object sender,
System.EventArgs e)

{

//Do Something


}
 
LOL sorry I sent it before I had finished damn numb fingers

I had this problem so try this try adding a please select entry to the
DropDownList. I found that if the user selected the first entry in the ddl
it obviously nver called the SelectIndexChanged event

Client Side


<TD vAlign="middle" align="left" width="50%">
<asp:dropdownlist id="AvailableClasses" runat="server" Width="200px"
AutoPostBack="True">
<asp:ListItem Value="Please Select">Please Select</asp:ListItem>
</asp:dropdownlist>
</TD>


Server Side
private void AvailableClasses_SelectedIndexChanged(object sender,
System.EventArgs e)

{

//Do Something


}
 
Hi Selen
How can I run dropdownlist_SelectedIndexChanged event on form load?

There is a good practise to write a method that will handle whole
work for event/events.
So you can write your own method e.g.:

private void DropDownListSelectedIndexChangedWork() {
// your code here
}

so you can call this method in *SelectedIndexChanged* handle:

private void dropdownlist_SelectedIndexChanged(object sender
, EventArgs e) {
this.DropDownListSelectedIndexChangedWork();
}

Regards

Marcin
 
Marcin said:
Hi Selen



There is a good practise to write a method that will handle whole
work for event/events.
So you can write your own method e.g.:

private void DropDownListSelectedIndexChangedWork() {
// your code here
}

so you can call this method in *SelectedIndexChanged* handle:

private void dropdownlist_SelectedIndexChanged(object sender
, EventArgs e) {
this.DropDownListSelectedIndexChangedWork();
}

I forgot...
And then you can call *DropDownListSelectedIndexChangedWork* method
in form *Load* event handle.

Marcin
 
Back
Top