M
Mark Rae
Hi,
Apologies, but I appear to be having a senior moment...
I have a standard DropDownList webcontrol with a SelectedIndexChanged event,
as follows:
<asp:TableCell ColumnSpan=4 VerticalAlign=Middle>
Select your delivery location:
<aspropDownList ID="cmbShipping" Runat="server"
OnSelectedIndexChanged="cmbShipping_SelectedIndexChanged"
AutoPostBack="true">
<asp:ListItem Value="0"> </asp:ListItem>
<asp:ListItem Value="1">United Kingdom</asp:ListItem>
<asp:ListItem Value="2">European Union</asp:ListItem>
<asp:ListItem Value="3">Rest of world</asp:ListItem>
</aspropDownList>
</asp:TableCell>
And the code-behind is as follows:
protected DropDownList cmbShipping;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
BindData();
}
}
public void cmbShipping_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
BindData();
}
catch (Exception ex)
{
CApplication.GlobalExceptionHandler(ex);
}
}
private void BindData()
{
// code to do the data binding goes here...
}
Problem is that the cmbShipping_SelectedIndexChanged() event only fires if
the SelectedValue of the DropDownList is greater than zero i.e. if I change
it from 0 to any other value, the event fires, but if I change it back to
zero the event doesn't fire...No errors are raised and, if I place a
breakpoint on the BindData(); line within the event code, it doesn't even
appear to jump into it...
I'm clearly missing something totally obvious...
Any assitance gratefully received.
Mark
Apologies, but I appear to be having a senior moment...
I have a standard DropDownList webcontrol with a SelectedIndexChanged event,
as follows:
<asp:TableCell ColumnSpan=4 VerticalAlign=Middle>
Select your delivery location:
<aspropDownList ID="cmbShipping" Runat="server"
OnSelectedIndexChanged="cmbShipping_SelectedIndexChanged"
AutoPostBack="true">
<asp:ListItem Value="0"> </asp:ListItem>
<asp:ListItem Value="1">United Kingdom</asp:ListItem>
<asp:ListItem Value="2">European Union</asp:ListItem>
<asp:ListItem Value="3">Rest of world</asp:ListItem>
</aspropDownList>
</asp:TableCell>
And the code-behind is as follows:
protected DropDownList cmbShipping;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
BindData();
}
}
public void cmbShipping_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
BindData();
}
catch (Exception ex)
{
CApplication.GlobalExceptionHandler(ex);
}
}
private void BindData()
{
// code to do the data binding goes here...
}
Problem is that the cmbShipping_SelectedIndexChanged() event only fires if
the SelectedValue of the DropDownList is greater than zero i.e. if I change
it from 0 to any other value, the event fires, but if I change it back to
zero the event doesn't fire...No errors are raised and, if I place a
breakpoint on the BindData(); line within the event code, it doesn't even
appear to jump into it...
I'm clearly missing something totally obvious...
Any assitance gratefully received.
Mark