سلام دوستان
برای لیست استان و شهر
از این کد استفاده کردم...دو دراپ لیست تو اپدیت پنل گذاشتم و تو ریوداد selectchange شرط انتخاب استان و شهرهاش را بیاورد و کار می کند
مشکلی که الان دارم اینه که میخوام وقتی کاربر استان و شهر ها رو ذخیره کرده و خارج شده وقتی لاگین می کنه اون دیتای ذخیره شده رو دراپ لیسته نشون بده
برای اونم یه تابع نوشتم که همه اطلاعات ثبت شده از جدول بخونه بیاره
که فقط دراپ لیست استان میاره ولی شهری که ذخیره کرده نمیاره
برای ایم چه کنم؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟



<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="font-family: Tahoma; font-size:12px;">
<tr>
<td style="padding-right:5px;width:250px;">
<span style="display:inline-block; text-align:right; width:73px;height:20px; margin-left:15px; font-family: Tahoma; font-size:12px;">استان :</span>
<asp:DropDownList ID="DropDownListostan" runat="server" DataSourceID="uxDropDownListos" AutoPostBack="true"
DataTextField="Names" DataValueField="ID" ValidationGroup="two" OnSelectedIndexChanged="DropDownListostan_Selected IndexChanged"

CssClass="txbox" Height="30px">
</asp:DropDownList>
<asp:SqlDataSource ID="uxDropDownListos" runat="server" ConnectionString="<%$ ConnectionStrings:SarAmadan %>" ProviderName="<%$ ConnectionStrings:SarAmadan.ProviderName %>" SelectCommand="select -1 as ID,N'لطفا انتخاب کنید' as Names union all Select ID, Names From Ostan "></asp:SqlDataSource>


<h4 class="star">*</h4>
</td>

<td style="padding-right:5px;width:250px;">
<span style="display:inline-block; text-align:right; width:73px;height:20px; margin-left:15px; font-family: Tahoma; font-size:12px;">شهرستان :</span>
<asp:DropDownList ID="DropDownListcit" runat="server" ValidationGroup="two"
CssClass="txbox" Height="30px">
</asp:DropDownList>

<h4 class="star">*</h4>
</td> <td></td>

</tr>

<tr>
<td style="padding-right:5px;width:250px;">

<asp:RequiredFieldValidator ID="RequiredFieldValidator11" InitialValue="-1" CssClass="error" ForeColor="red" runat="server" ControlToValidate="DropDownListostan"
ErrorMessage="لطفا استان خود را وارد نمایید" ValidationGroup="two"
Display="Dynamic" Visible="true" SetFocusOnError="true" ></asp:RequiredFieldValidator>
</td>

<td style="padding-right:5px;width:250px;">


</td>

<td style="padding-right:5px;width:250px;">
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" InitialValue="-1" CssClass="error" ForeColor="red" runat="server" ControlToValidate="DropDownListcit"
ErrorMessage="لطفا شهر خود را وارد نمایید" ValidationGroup="two"
Display="Dynamic" Visible="true" SetFocusOnError="true" ></asp:RequiredFieldValidator>

</td>

</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownListostan"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" style="font-size:12px;color:green; margin-right:80px;font-weight:600;direction:rtl; ">
<ProgressTemplate>
لطفا چند لحظه صبر کنید
</ProgressTemplate>
</asp:UpdateProgress>



<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table style="font-family: Tahoma; font-size:12px; margin-top:30px;">
<tr>
<td style="padding-right:5px;width:250px;">
<span style="display:inline-block; text-align:right; width:73px;height:20px; margin-left:15px; font-family: Tahoma; font-size:12px;">استان :</span>
<asp:DropDownList ID="DropDownListworkostan" runat="server" DataSourceID="uxDropDownListosew"
DataTextField="Names" DataValueField="ID" AutoPostBack="true" OnSelectedIndexChanged="DropDownListworkostan_Sele ctedIndexChanged"

CssClass="txbox" Height="30px">
</asp:DropDownList>
<asp:SqlDataSource ID="uxDropDownListosew" runat="server" ConnectionString="<%$ ConnectionStrings:SarAmadan %>" ProviderName="<%$ ConnectionStrings:SarAmadan.ProviderName %>" SelectCommand="select -1 as ID,N'لطفا انتخاب کنید' as Names union all SELECT ID, Names FROM Ostan "></asp:SqlDataSource>


</td>

<td style="padding-right:5px;width:250px;">
<span style="display:inline-block; text-align:right; width:73px;height:20px; margin-left:15px; font-family: Tahoma; font-size:12px;">شهرستان :</span>
<asp:DropDownList ID="DropDownListworkcit" runat="server"

CssClass="txbox" Height="30px">
</asp:DropDownList>
</td> <td style="padding-right:5px;width:250px;"></td>

</tr>
</table>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownListworkostan"
EventName="SelectedIndexChanged" />
</Triggers>


</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" runat="server" style="font-size:12px;color:green; margin-right:80px;font-weight:600;direction:rtl; ">
<ProgressTemplate>
لطفا چند لحظه صبر کنید
</ProgressTemplate>
</asp:UpdateProgress>






protected void DropDownListworkostan_SelectedIndexChanged(object sender, EventArgs e)
{
string ostannwork = DropDownListworkostan.SelectedValue;
SqlConnection con = new SqlConnection(cs);
string command = @"select * from city
where OstanID=@OstanID";
SqlCommand cmd = new SqlCommand(command, con);
cmd.Parameters.AddWithValue("@OstanID", ostannwork);
try
{

con.Open();
cmd.ExecuteNonQuery();
drr1 = cmd.ExecuteReader();

DropDownListworkcit.DataSource = drr1;
DropDownListworkcit.DataValueField = "ID";
DropDownListworkcit.DataTextField = "NameC";
DropDownListworkcit.DataBind();
}
catch (Exception er)
{

resultError.Text = er.ToString();

}

finally
{

con.Close();
}
}


protected void DropDownListostan_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(cs);
string command = @"select * from city
where OstanID=@OstanID";
SqlCommand cmd = new SqlCommand(command, con);
cmd.Parameters.AddWithValue("@OstanID", DropDownListostan.SelectedValue);
try
{

con.Open();
cmd.ExecuteNonQuery();
dr1 = cmd.ExecuteReader();

DropDownListcit.DataSource = dr1;
DropDownListcit.DataValueField = "ID";
DropDownListcit.DataTextField = "NameC";
DropDownListcit.DataBind();
}
catch (Exception er)
{

resultError.Text = er.ToString();

}

finally
{

con.Close();
}

}