hi ALL
i'm using the dropdown list control in my page
when select some item in the drop down and press the submit button
i need to get the selected item from the drop down
but i getting only the first item not the selected item
i loading the dropown items dynamically from the database
my code is
aspx
------
<
asp:DropDownList runat="server" Width="120px" ID="drp_SubhurbList"
OnSelectedIndexChanged = "drp_SubhurbList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:ImageButton runat="server" ID="btnCalculateShipping" OnClick="UpdateButton_Click"
SkinID="Continue" AlternateText="GO" Style="position:absolute" />
c#
---
protected void UpdateButton_Click(object sender, EventArgs e)
{
if (drp_SubhurbList != null)
if (drp_SubhurbList.SelectedItem != null && drp_SubhurbList.SelectedItem.Text != string.Empty)
{
Session[
"state"] = string.Empty;
Session[
"state"] = drp_SubhurbList.SelectedItem.Text.ToString();
}
}
public void bindDropDownList()
{
//dtCities is a datatable
drp_SubhurbList.Items.Clear();
drp_SubhurbList.DataSource = dtCities;
drp_SubhurbList.DataTextField =
"state";
drp_SubhurbList.DataValueField =
"zipcode";
}
it always getting the first item forexample
if i having the items like
chennai
bangalore
delhi
kashir
mumbai
and when i select delhi and press submit button
it returning the chennai for always
please advice me
thanks in advance
MUTHU