Have a look at this example I have created for you, it works with SqlDataSource, but you will use the same idea with ObjectDataSource:
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
DataTextField="FirstName" DataValueField="ContactID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"
SelectCommand="SELECT TOP 5 [ContactID], [FirstName] FROM Person.Contact">
</asp:SqlDataSource>
In the code behind you add this:
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
// Make sure you run this code inly when there is a valid QueryString
if (!string.IsNullOrEmpty(Request.QueryString["ContactID"]))
{
// Retrieve the QueryString
string contactID = Request.QueryString["ContactID"].ToString();
// If the QueryString value is among the loaded items in the
// DropDownList, select it.
ListItem lt = this.DropDownList1.Items.FindByValue(contactID);
if (lt != null)
lt.Selected = true;
}
}
You would call tha page for example with http://localhost/web/page.aspx?ContactId=3 and it will select the 3rd record for you in the DDL. If you skip the ContactID in the query string, it will show the first item in the DDL as the selected one!
Hope this helps!
Regards