标题:updatepanel没有实现局部刷新
只看楼主
Augustin
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2010-7-16
结帖率:0
已结贴  问题点数:20 回复次数:2 
updatepanel没有实现局部刷新
RT。

aspx局部代码如下
程序代码:
<asp:UpdatePanel ID="UpdatePanel1"
                                        runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                                                <asp:ListItem Text="请跟进" Value="请跟进"></asp:ListItem>
                                                <asp:ListItem Text="请核实" Value="请核实"></asp:ListItem>
                                                <asp:ListItem Text="已报名" Value="已报名"></asp:ListItem>
                                                <asp:ListItem Text="未报名" Value="未报名"></asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("id") %>' />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
.cs DropDownList1_SelectedIndexChanged事件代码如下
程序代码:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //string value = ((DropDownList)dataListSchool.FindControl("DropDownList1")).SelectedItem.Text;
            foreach (DataListItem item in dataListSchool.Items)
            {
                if ((item.ItemType == ListItemType.Item ) || (item.ItemType == ListItemType.AlternatingItem) || (item.ItemType == ListItemType.SelectedItem))
                {
                    string value = ((DropDownList)item.FindControl("DropDownList1")).SelectedValue;
                    int id = Convert.ToInt32(((HiddenField)item.FindControl("HiddenField1")).Value);
                    switch (value)
                    {
                        case "请跟进":
                            DbHelperSQL.ExecuteSql("update person set mark = '请跟进' where id = " + id);
                            break;
                        case "请核实":
                            DbHelperSQL.ExecuteSql("update person set mark = '请核实' where id = " + id);
                            break;
                        case "未报名":
                            DbHelperSQL.ExecuteSql("update person set mark = '未报名' where id = " + id);
                            break;
                        case "已报名":
                            DbHelperSQL.ExecuteSql("update person set mark = '已报名' where id = " + id);
                            break;
                        default:
                            break;
                    }
                }
            }

        }
搜索更多相关主题的帖子: updatepanel 局部 
2010-10-20 14:10
筱晓绾
Rank: 10Rank: 10Rank: 10
来 自:湖南
等 级:贵宾
威 望:12
帖 子:512
专家分:1736
注 册:2010-9-1
得分:10 
貌似updatepanel上面还应该放个
<asp:ScriptManager ID="smPage" runat="server">
</asp:ScriptManager>
吧!不知道是不是这个原因咯~~~~
2010-10-22 14:27
taotaojyc
Rank: 2
等 级:论坛游民
帖 子:8
专家分:26
注 册:2010-10-22
得分:10 
对,上面要加<asp:ScriptManager ID="smPage" runat="server">
</asp:ScriptManager>
2010-10-22 15:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-323430-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.774062 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved