August 2009
M T W T F S S
« Jul   Sep »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Catching Exception in dropdownlist select value

try
{
ddl.SelectedValue = “value_from_db”;
ddl.DataSoure = myDataSource();
ddl.DataValueField = “value”;
ddl.DataTextField = “text”;
ddl.DataBind();
}
catch (ArgumentOutOfRangeException myException)
{
//exception will be caught if SelectedValue is not in the ddl
//no exception caught if SeletedValue is in the ddl
if (ddl.items.count > 0)
ddl.SelectIndex = -1;
}

Pirates of silicon valley

[youtube=http://www.youtube.com/watch?v=J9GGdsepMGU&feature=PlayList&p=3BA3E79BC0FDA988&index=7]

Could not load type ‘System.Web.UI.ScriptReferenceBase’ from assembly ‘System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′. error

Solution:

change:
<ajaxToolkit:ToolkitScriptManager ID=”ScriptManager1″ runat=”server” />
to:
<asp:ScriptManager ID=”ScriptManager1″ runat=”server” />