Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 774319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:06:43+00:00 2026-05-14T19:06:43+00:00

Yes, it’s the infamous viewstate again! Now I am aware that problems can ocurr

  • 0

Yes, it’s the infamous viewstate again!

Now I am aware that problems can ocurr if you load controls in the wrong order or if the viewstate IDs are incorrect after postbacks etc etc.

But my issue is that I am not really creating any controls dynamically – I only have one user control on the page.

More importantly, the issue seems to be occuring with just one user.

What could be the problem? Corrupt browser cache?

Any help appreciated.

thanks,

KS

Hi, ok – so I’ve narrowed it down a bit more. When I select an item from a drop down list control (which is a UserControl) – and then attempt to rebind my grid using the selected value, the error occurs.

The selectedvalue on postback seems to be zero every time (because the control is not in the viewstate somehow?!).

The UserControl (containing the dropdownlist) is added at design-time.

Hi, thanks for your reponse. What logic should I try moving to OnPreRender?

Another thing I missed…

-The first bind of grid works fine (on first time page load).
-Selecting value from dropdownlist causes postback in which grid is bound again using values – works fine also.
-When I click another button (which also triggers binding for grid), the viewstate error occurs.

Below is some code:


UserControl Source:

Imports iMWeb_BUL
Imports System.Data

Partial Class TitleList
Inherits System.Web.UI.UserControl

Public Event IndexHasChanged(ByVal sender As Object, ByVal e As CommandEventArgs)

Public Property TitleID() As Integer
    Get
        Return IIf(DDL_Titles.SelectedValue = Nothing, 0, DDL_Titles.SelectedValue)
    End Get
    Set(ByVal value As Integer)
        Try
            DDL_Titles.SelectedValue = value
        Catch
        End Try
    End Set
End Property

Public ReadOnly Property TitleTable() As DropDownList
    Get
        Return DDL_Titles
    End Get
End Property

Public ReadOnly Property TitleName() As String
    Get
        If DDL_Titles.SelectedValue > 0 Then
            Return DDL_Titles.SelectedItem.ToString()
        Else
            Return Nothing
        End If
    End Get
End Property

Public Sub DDL_Titles_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDL_Titles.SelectedIndexChanged
    Dim ee As CommandEventArgs = New CommandEventArgs(DDL_Titles.SelectedValue, Nothing)
    RaiseEvent IndexHasChanged(Me, ee)
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        'bind dropdownlist
        common.BindDDLs("MovieListDemo", "[SP_ListTitlesDEMO]", "MOV_ID", "movie_name", true, DDL_Titles, Nothing)
    End If
End Sub

End Class

Main page logic (pseudo):

Sub Page_Load
 If not postback
  bindGrid()
 End If

If UserControl1.IndexChanged
 bindGrid()
End If

If Button1.clicked
 bindGrid() <---- error occurs here
End if

Sub bingGrid
 fetch data passing param TitleList1.TitleID (usercontrol)
End Sub

End Sub

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:06:43+00:00Added an answer on May 14, 2026 at 7:06 pm

    Try moving your logic into OnPreRender

    and/or In the OnLoad event, build the page with the current parameter, so that the DropDownList can get rebuilt correctly, then redraw the page with the new parameter and see if the problem goes away.

    What’s likely happening is the DropDownList has viewstate but the content of the control has changed before ViewState is reprocessed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yes, I'm aware that this question has already been post, but ... I'm looking
Yes, I know that UndecidableInstances can be bad. I really tried hard to design
Yes, I'm well aware of OpenID with Django . And I also notice that
yes this question is asked some times. but I can't find an answer for
Yes, I understand that JavaScript doesn't have classes per se, so I'll just throw
Yes that sounds overly complicated. I am trying to mine data from pages on
Yes, it's a newb question. I want to make a timetabling application that these
Yes, I am aware of How to incorporate WebSockets into a Cocoa application ,
Yes, I can't. It seems weird ostream has no close, since istream can detect
Yes I know Ruby doesn't have pointers, but that's the closest I could get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.