Second Solution
You use html, javascript e C#.
In the html code, you will use the button to call the function to process the value.
This button will be hidden.
function _submit()
{
var e = document.getElementById("combobox");
var id = e.options[e.selectedIndex].value;
alert('Value selected is: ' + id);
}
<div>
<asp:DropDownList ID="combobox" runat="server">
<asp:ListItem Text="Item 1" Value="1"></asp:ListItem>
<asp:ListItem Text="Item 2" Value="2"></asp:ListItem>
<asp:ListItem Text="Item 3" Value="3"></asp:ListItem>
<asp:ListItem Text="Item 4" Value="4"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnOCRunScript" style="visibility:hidden;" runat="server" OnClientClick="_submit();" Text="RodarScript" />
</div>
In the code-behind, in the page load event, you set the value, and then register the script to dynamically click the button on the html page.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.combobox.SelectedIndex = 2;
string script = "document.getElementById(\"btnOCRunScript\").click();";
if (!this.Page.ClientScript.IsStartupScriptRegistered(this.GetType(), "runbutton"))
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "runbutton",script, true);
}
}
}