有SelectedIndexChanged事件的控件的刷新问题-需要点击两下才能刷新的问题
2009-09-13 02:32
471 查看
对于有SelectedIndexChanged事件的控件,在这个事件的处理语句最后要加上
重新绑定的语句,才能刷新,否则要点击两下。
例如
<asp:DropDownList ID="DropDownListParentCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListParentCategory_SelectedIndexChanged" AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="-1">==请选择==</asp:ListItem>
<asp:ListItem Value="0">图书商品类</asp:ListItem>
<asp:ListItem Value="1">网站文章类</asp:ListItem>
</asp:DropDownList>
在其事件中,如不添加
DropDownListParentCategory.DataBind();语句,则需要点击两下才能刷新。
protected void DropDownListParentCategory_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownListParentCategory.DataBind();
}
此内容适合于任何有SelectedIndexChanged事件的控件。例如DataList
重新绑定的语句,才能刷新,否则要点击两下。
例如
<asp:DropDownList ID="DropDownListParentCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListParentCategory_SelectedIndexChanged" AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="-1">==请选择==</asp:ListItem>
<asp:ListItem Value="0">图书商品类</asp:ListItem>
<asp:ListItem Value="1">网站文章类</asp:ListItem>
</asp:DropDownList>
在其事件中,如不添加
DropDownListParentCategory.DataBind();语句,则需要点击两下才能刷新。
protected void DropDownListParentCategory_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownListParentCategory.DataBind();
}
此内容适合于任何有SelectedIndexChanged事件的控件。例如DataList
相关文章推荐
- bootstrap popover与a标签点击事件冲突,需要点击两下才能显示问题
- 2013-2-5 Activity跳转,解决已存在Activity未刷新,导致列表点击事件不响应问题
- 解决点击左边菜单栏需要点击两下的问题
- 要在当前页面刷新,触发点击事件才可以显示效果的问题
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- AutoCompleteTextView 设置了点击事件需要点击两下解决办法
- Listview点击事件失效问题解决以及每个Item 子控件获取focus
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- Popuwindow点击外部控件切换popuwindow——解决点击外部事件不响应问题。
- Butterknife 绑定控件后,点击事件判断为空,问题解决方法一
- ListView中控件点击事件与Item点击事件冲突的问题
- web网站css,js更新后客户浏览器缓存问题,需要刷新才能正常展示的解决办法
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- Asp.net 2.0自定义控件(点击HyperLink后执行事件)[网友问题: DataList里HyperLink控件激发事件,在哪定义?]
- 安卓子控件抢占父控件点击事件或者焦点问题
- UpdatePanel控件中使用GridView时,RowCommand事件执行删除后,GridView不刷新问题。
- 局部刷新 与 点击按钮弹出窗口 (ajax 控件 updatepanel ModalPopupExtender ) 今天怎么老出问题呢