更新面板不工作在asp.net code

问题描述:

这是我的C#$ C $后面

This is my c# code behind

protected void callDispositionChanged(object sender, EventArgs e)
{
    var dropDown = (DropDownList)ListView1.FindControl("callDispositionSelector");
    var visitID = (TextBox)ListView1.FindControl("visitID");
    if (dropDown != null)
    {
        Response.Write(dropDown.SelectedValue + "ssssssssss");
        visitID.Text = dropDown.SelectedValue;
    }
    else
    {
        visitID.Text = "ffffff";
        Response.Write("FFFFFFFFFFFFFFFF");
    }               
}

这是我的ASP code

this is my asp code

<asp:UpdatePanel ID="UpdatePanel3" UpdateMode="Conditional" runat="server">
                        <ContentTemplate>
                        <tr class="footer" runat="server">
                            <td colspan="4" runat="server">* By VoiceMpower
                               <asp:DropDownList AutoPostBack="true" runat="server"  ID="callDispositionSelector" OnSelectedIndexChanged="callDispositionChanged" clientidmode="Static">
                                   <asp:ListItem Value="-1">Select Disposition Reason</asp:ListItem>
                                   <asp:ListItem Value="1">Reservation</asp:ListItem>
                                   <asp:ListItem Value="2">Change of Reservation</asp:ListItem>
                                   <asp:ListItem Value="3">Cancellation</asp:ListItem>
                                   <asp:ListItem Value="4">Wait List</asp:ListItem>
                                   <asp:ListItem Value="5">Other</asp:ListItem>
                               </asp:DropDownList>
                                <asp:TextBox runat="server" ID="visitID" clientidmode="Static"></asp:TextBox>
                            </td>
                        </tr>
                         </ContentTemplate>
                    </asp:UpdatePanel>

当我改变选择的值,函数被执行,但结果(后背页)已经在devaul vaule选择。

when I change the value of the select, the function is executed, but the results (the post back page) has the select in the devaul vaule.

我已经有

<asp:ScriptManager ID="ScriptManager2" runat="server" />

注释3

这是ASP code在 asp.listview

我无法调试该项目,因为在服务器和数据库,我不能做一个链接。所以,我每开发一个functoin的时候,我去部署在服务器上的网站并进行测试。所以,请让你的答案未做破发点和类似的东西。在此先感谢

I can't debug the project because the database on the server and I am not allowed to make a link to it. So each time i develop a functoin, I go and deploy the website on the server and test it. So please let your answers without making break points and something like that. thanks in advance

您正在使用条件模式,这意味着,更新面板就不会工作,除非该事件被触发。

You are using Conditional Mode which means, the update panel will not work, unless the event is triggered.

删除。

 <asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>
                <tr class="footer" runat="server">
                    <td colspan="4" runat="server">* By VoiceMpower
                           <asp:DropDownList AutoPostBack="true" runat="server" ID="callDispositionSelector" OnSelectedIndexChanged="callDispositionChanged" ClientIDMode="Static">
                               <asp:ListItem Value="-1">Select Disposition Reason</asp:ListItem>
                               <asp:ListItem Value="1">Reservation</asp:ListItem>
                               <asp:ListItem Value="2">Change of Reservation</asp:ListItem>
                               <asp:ListItem Value="3">Cancellation</asp:ListItem>
                               <asp:ListItem Value="4">Wait List</asp:ListItem>
                               <asp:ListItem Value="5">Other</asp:ListItem>
                           </asp:DropDownList>
                        <asp:TextBox runat="server" ID="visitID" ClientIDMode="Static"></asp:TextBox>
                    </td>
                </tr>
            </ContentTemplate>
        </asp:UpdatePanel>