I have a modalpopup which is showed automaticaly on startup of page. I'm doing this on Page_Load event.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitiallizeAll();
}
}
private void InitiallizeAll()
{
ModalPopupExtender1.Show();
}
In aspx side I have a dropdownlist on a modalpopup but the index is always posting zero to the javascript code.
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="lnkPopup"
PopupControlID="panEdit"
BackgroundCssClass="modalBackground"
OkControlID="btnGonder"
OnOkScript="onOk()">
</asp:ModalPopupExtender>
<asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="modalPopup">
<table width="100%">
<tr>
<td class="labelCell">
<asp:Label ID="lblBolge" Text="Bölge" runat="server" />
</td>
<td>
<asp:DropDownList ID="ddlIl" runat="server"
AutoPostBack="False"
DataTextField="Isim"
DataValueField="Id"
DataSourceID="ObjectDataSource1"
Width="176px">
</asp:DropDownList>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetAllIl"
TypeName="ERK.Lasos.Business.CustomEntities.Il">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0"
Name="ilId"
QueryStringField="bolge"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
<br />
<asp:Button ID="btnGonder" runat="server" Text="Devam Et" />
</asp:Panel>
<a id="lnkPopup" runat="server">Show Popup</a>
And this is my javascript code
<script type="text/javascript">
function onOk() {
var e = document.getElementById("ddlIl");
var selectedIlId = e.options[e.selectedIndex].value;
window.location = "/Pages/AnaSayfa/LasosAnaSayfa.aspx?bolge=" + selectedIlId;
}
</script>
But I'm always getting selectedIlId is "0". Value is not changing whatever I select from dropdownlist