Professional Web Applications Themes

Dropdownlist not keeping viewstate after postback - ASP.NET Data Grid Control

I have a complex datagrid containing several ASP.NET form elements. One of the elements is a checkboxlist. This is populated from a database but the data it is populated with is dependent upon the current value in one of the datagrid's dropdownlist boxes. The dropdownlist is set for AutoPostBack. However, when the postback occurs and the datagrid redisplayed, the dropdownlist doesn't keep the value it had when postback ocurred. How do I get around this problem? Thanks, David...

  1. #1

    Default Dropdownlist not keeping viewstate after postback

    I have a complex datagrid containing several ASP.NET form elements.
    One of the elements is a checkboxlist. This is populated from a
    database but the data it is populated with is dependent upon the
    current value in one of the datagrid's dropdownlist boxes.

    The dropdownlist is set for AutoPostBack. However, when the postback
    occurs and the datagrid redisplayed, the dropdownlist doesn't keep the
    value it had when postback ocurred.

    How do I get around this problem?

    Thanks,
    David
    David Wyn Davies Guest

  2. #2

    Default Re: Dropdownlist not keeping viewstate after postback

    Hi David,

    For your query, you would need to check following three things:

    1. You need to populate the Dropdown list when the page is not post back,
    i.e, If !PostBack then populate it.

    2. You need to populate the CheckBox everytime the page loads.

    3. Please ensure the Enable.ViewState property is set to true.

    HTH

    Mona[Grapecity]


    "David Wyn Davies" <david***.daviesntlworld.com> wrote in message
    news:9bde91hflbsa3q3q5pe1c68m5d6d468kcf4ax.com...
    >I have a complex datagrid containing several ASP.NET form elements.
    > One of the elements is a checkboxlist. This is populated from a
    > database but the data it is populated with is dependent upon the
    > current value in one of the datagrid's dropdownlist boxes.
    >
    > The dropdownlist is set for AutoPostBack. However, when the postback
    > occurs and the datagrid redisplayed, the dropdownlist doesn't keep the
    > value it had when postback ocurred.
    >
    > How do I get around this problem?
    >
    > Thanks,
    > David

    Mona Guest

Similar Threads

  1. Persisting DataSource on Postback using ViewState
    By Chris Carter in forum ASP.NET
    Replies: 4
    Last Post: March 7th, 12:50 PM
  2. DropDownList + ViewState (Validation requirement)
    By itaitai2003@yahoo.com in forum ASP.NET Security
    Replies: 0
    Last Post: March 9th, 02:14 PM
  3. Keeping DataGrid Columns through Postback
    By in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 19th, 04:52 PM
  4. Getting PostBack Data from DropDownList Control
    By Lance in forum ASP.NET Building Controls
    Replies: 2
    Last Post: December 5th, 01:16 AM
  5. Dropdownlist in Server Control loses Viewstate
    By Graham Stevenson in forum ASP.NET Building Controls
    Replies: 2
    Last Post: December 3rd, 09:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139