event not firing: DropDownList or else generates error at runtime

B

Brian Fulford

Related to using VB as code behind language.

ASPX page control: when OnSelectedIndexChanged attribute is not added page renders fine but no event fires; when attribute is added to indicate the event sub to go to, an error is generated as follows:

? server.GetLastError

{System.Web.HttpException}

[System.Web.HttpException]: {System.Web.HttpException}

HelpLink: Nothing

InnerException: {System.Web.HttpCompileException}

Message: "External component has thrown an exception."

Source: "System.Web"

Actual ASPX html:

<asp:DropDownList id="ddlDateRange" runat="server" Width="150px" AutoPostBack="false" OnSelectedIndexChanged="ddlDateRange_SelectedIndexChanged"></asp:DropDownList>

VB code behind:

Public Class ccsm_filters2

Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

Protected WithEvents UltraWebTab1 As Infragistics.WebUI.UltraWebTab.UltraWebTab

Public ddlDateRange As DropDownList



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Private Sub ddlDateRange_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

Select Case ddlDateRange.SelectedIndex



I guess I am not sure how the event should be wired so as to fire and I need to change variables and labels based upon what the user picked from the drop down list. Any help would be much appreciated.



Brian
 
J

jagadeesh

Are the labels are in the same page? In that case you need to make the autopostback property true. This will fire the event properly. Try setting this property.

Related to using VB as code behind language.

ASPX page control: when OnSelectedIndexChanged attribute is not added page renders fine but no event fires; when attribute is added to indicate the event sub to go to, an error is generated as follows:

? server.GetLastError

{System.Web.HttpException}

[System.Web.HttpException]: {System.Web.HttpException}

HelpLink: Nothing

InnerException: {System.Web.HttpCompileException}

Message: "External component has thrown an exception."

Source: "System.Web"

Actual ASPX html:

<asp:DropDownList id="ddlDateRange" runat="server" Width="150px" AutoPostBack="false" OnSelectedIndexChanged="ddlDateRange_SelectedIndexChanged"></asp:DropDownList>

VB code behind:

Public Class ccsm_filters2

Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

Protected WithEvents UltraWebTab1 As Infragistics.WebUI.UltraWebTab.UltraWebTab

Public ddlDateRange As DropDownList



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Private Sub ddlDateRange_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

Select Case ddlDateRange.SelectedIndex



I guess I am not sure how the event should be wired so as to fire and I need to change variables and labels based upon what the user picked from the drop down list. Any help would be much appreciated.



Brian
 
B

Brian Fulford

That did not help out the situation, same error as before. As long as I leave out the onSelectedIndexChanged event on the server control tag, the page loads fine but of course there is no event wiring.

Any other suggestions as to the cause or resolution?
Are the labels are in the same page? In that case you need to make the autopostback property true. This will fire the event properly. Try setting this property.

Related to using VB as code behind language.

ASPX page control: when OnSelectedIndexChanged attribute is not added page renders fine but no event fires; when attribute is added to indicate the event sub to go to, an error is generated as follows:

? server.GetLastError

{System.Web.HttpException}

[System.Web.HttpException]: {System.Web.HttpException}

HelpLink: Nothing

InnerException: {System.Web.HttpCompileException}

Message: "External component has thrown an exception."

Source: "System.Web"

Actual ASPX html:

<asp:DropDownList id="ddlDateRange" runat="server" Width="150px" AutoPostBack="false" OnSelectedIndexChanged="ddlDateRange_SelectedIndexChanged"></asp:DropDownList>

VB code behind:

Public Class ccsm_filters2

Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

Protected WithEvents UltraWebTab1 As Infragistics.WebUI.UltraWebTab.UltraWebTab

Public ddlDateRange As DropDownList



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Private Sub ddlDateRange_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

Select Case ddlDateRange.SelectedIndex



I guess I am not sure how the event should be wired so as to fire and I need to change variables and labels based upon what the user picked from the drop down list. Any help would be much appreciated.



Brian
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top