A common DropDownList issue I've seen on many forums and lists is about a DropDownList populating items 2x or not being able to get the selected value on postback when binding to a data source. This is due to the DropDownList having data bound to it again on postback before the form is processed. To prevent this, you will need to ensure that the DropDownList is only bound to data on the initial load of the page.
VB.NET
Private Sub
Page_Load(
ByVal
sender
As Object
,
ByVal
e
As
EventArgs)
If Not
IsPostBack
Then
' Code here to bind data to DropDownList
End If
End Sub
C#
private void
Page_Load(
object
sender,
EventArgs
e)
{
if
(!IsPostBack)
{
// Code here to bind data to DropDownList
}
}
R
Came accross a funny post on the ASP.NET forums. Good stuff.
http://forums.asp.net/1103287/ShowPost.aspx
R
What is parametric polymorphism? It sounds like such a cool phrase. Parametric polymorphism is a function or datatype that can be written generically so that it can deal equally well with any objects without depending on their type. .NET Generics are derived from the principles of parametric polymorphism.
There is even a formula for parametric polymorphism.
"Any dynamically typed function
f
that takes
n
arguments can be given a static type using parametric polymorphism:
f
:
p
1
× ... ×
p
n
→
r
, where
p
1
, ...,
p
n
and
r
are type parameters."
What practical bearing does this formula have on .NET Generics? Nothing, but I'm a math person and I think formulas are cool.
R