Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a problem with controls on a webform not storing the selected index after a postback.

 

The controls are databound only once ( in createMenu() ) as I use

 

  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       'Put user code to initialize the page here
       If Not IsPostBack Then
           CreateMenu()
           InitialiseDates()
           panelParams.Visible = False
       End If
   End Sub

 

The postback is initiated by a click on a button

Private Sub cmdGenerateReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGenerateReport.Click
       LoadReport()
       DateSelect()
   End Sub

 

Neither Loadreport() or DateSelect() call a databind

 

The View state for the controls is on

 

it does not seem to matter what list control I use (dropdownlist, radiobuttonlist etc) but the selected index is always reset to 0 after the postback

 

I have seen lots of examples of the same problem in forums and on the web but no one seems to have posted an answer that I can get to work.

 

Can you help?

 

Thanks

 

JAS

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...