Data Browser
- Viewing Site
Sector 23 Code Bank
Logged in as:
Guest
Similar Topics...
Set width of anchor (a) in CSS
Sql Server 2008 Comma Delimited List
Determine which roles can access a .NET page
Multiple Angular Slickgrids on same page showing wrong data
Add a Print button to a page
Setting .NET DropDownList to Enabled = False Turns Page Gray
Reporting Services - The Item '/Data Sources' Does Not Exist - Lost Administrator rights to SSRS
project could not be opened because the microsoft visual c# compiler could not be created QueryService for '{7D960B16-7AF8-11D0-8E5E-00A0C911005A}' failed
Dynamically Add jQuery Mobile Support to a .NET Page
NET Designer - Image Could Not Be Set On Property Error
Create a Dynamic Column and Row List with Flex Property
Bootstrap dropdown - show on hover
JavaScript: Insert an item into an array
Angular drop down select item with null value
How to filter an Angular list on the fly
Link to File on Local Server from TreeView Web Page
How to add meta tags like keywords to an Angular 11 page
Page-Break-After results in extra page in Chrome
OpenXml - Add Page # to PPTX Slide
How to Dynamically Add a UserControl to a Page
Webpage has expired error message after back button to page with ToolkitScriptManager
jQuery Mobile - All Hyperlinks go to blank page that doesn't load
Customize selected item in ng-select
Responsive Page Design Using Page Web Methods
Angular7 bind object to select dropdown example
Force DataGridView RowValidated to fire
ASP.NET GridView Set Width of Column
Fixed/Floating Grid Header for ASP.NET GridView
Handle Exception on ObjectDataSource bound to GridView
.NET Export GridView to a CSV (that Excel can Actually Read)
SSRS - Comparing multi-value parameter to NULL crashes report viewer
Read .NET Resource Value from JavaScript
Image.Save: Value cannot be null. Parameter name: encoder
SSRS Send multi valued parameter filter to stored procedure
SSRS Parameter default value is blank when deployed to server
RegisterClientScriptInclude fails on partial postback in update panel
DropDownList Nested in GridView Loses Value After Postback
A
dropdown
list
created
on an.aspx
page
or
designer
with static
list
item
s
that
is nested in
a
Template
Column
on an
ASP.NET
GridView
in
ASP.NET
4.0
will not
retain
its
selected
value
if the
page
post
s
back
. It resets to the first
item
in the
list
, instead of restoring the last
selected
item
.
I don't know why this is; it seems
like
a
bug
. However, I
found
the following workaround which resolved the
issue
:
Instead of
creating
the static
drop
down
list
on the aspx
page
(with asp:ListItems),
create
a
custom
dropdown
Server
Control
(
a
class
that
inherits from
DropDownList
). Initialize the ListItems in the
class
's constructor.
Register
the
server
control
on your
page
or in your web.config, and
replace
the asp:DropDownList with your custom:NewDropDownList.
Now, when the
page
post
s
back
, the
selected
value
will be retained.
Created By: amos
11/2/2011 11:47:34 AM
Updated:
4/6/2015 3:25:18 AM