Asp.net aspx dropdownList不维护所选值
继承的代码带有用于填充某些GridView的dropdownlist。当在dropdownlist中进行选择时,选择不会保留,它会跳回到第一条记录。一个经常提到的修复方法是添加!Page_Load事件中的Page.IsPostBack,但这样做并不能解决问题Asp.net aspx dropdownList不维护所选值,asp.net,postback,Asp.net,Postback,继承的代码带有用于填充某些GridView的dropdownlist。当在dropdownlist中进行选择时,选择不会保留,它会跳回到第一条记录。一个经常提到的修复方法是添加!Page_Load事件中的Page.IsPostBack,但这样做并不能解决问题 <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true" DataSourceID="SqlDataSource2" DataTextFie
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true"
DataSourceID="SqlDataSource2" DataTextField="FullAddress"
DataValueField="UniqueRecordID" Width="445px" Height="20px"
style="margin-left: 0px" TabIndex="8" AppendDataBoundItems="true"
OnSelectedIndexChanged="resetGridsAndLabel">
</asp:DropDownList>
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DropDownList2.DataSource = sqlDataSource2;
DropDownList2.DataBind();
}
公共部分类\u默认值:第页
{
受保护的无效页面加载(对象发送方、事件参数e)
{
如果(!Page.IsPostBack)
{
DropDownList2.DataSource=sqlDataSource2;
DropDownList2.DataBind();
}
您是否在页面上的任何其他位置设置DDL的数据源