本文介绍了控件ID找不到的AsyncPostBackTrigger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < ASP:的UpdatePanel ID =CartUpdatePanel=服务器>
        <&触发器GT;
            < ASP:AsyncPostBackTrigger控件ID ='<%= rdoSelect.ClientID%GT;/>
        < /触发器>
        <&的ContentTemplate GT;
            < ASP:定时器ID =cartTimer间隔=5000=服务器OnTick =cartTimer_Tick>
            < / ASP:定时器>
            < ASP:GridView控件ID =gridCartSearch=服务器的AutoGenerateColumns =FALSE>
                <柱体和GT;
                    < ASP:的TemplateField的HeaderText =选择>
                        <&ItemTemplate中GT;                            < ASP:HiddenField ID =串行=服务器值='<%#的eval(SERIALNUM)%>' />
                            < ASP:单选按钮ID =rdoSelect=服务器的AutoPostBack =真正的组名=radioBtns
                                OnCheckedChanged =rdoSelect_CheckedChanged/>
                        < / ItemTemplate中>
                    < / ASP:的TemplateField>                < /专栏>
            < / ASP:GridView的>
        < /&的ContentTemplate GT;
    < / ASP:的UpdatePanel>

我收到以下错误

解决方案

I tried <asp:AsyncPostBackTrigger ControlID='rdoSelect'/> but it’s not working.

I found a solution here A control with ID 'ImageButton5' could not be found for.

The AsyncPostBack should be registered whenever a row is created.

protected void gridCartSearch_RowCreated(object sender, GridViewRowEventArgs e)
        {
            Control radioControl = e.Row.Cells[0].FindControl("rdoSelect");
            if (radioControl != null)
            {
                cartScriptMgr.RegisterAsyncPostBackControl(radioControl);
            }

        }

Update the Update Panel On rdoSelect_CheckedChanged

  protected void rdoSelect_CheckedChanged(object sender, EventArgs e)
        {
            ....
            CartUpdatePanel.Update();

        }

using <asp:AsyncPostBackTrigger ControlID='rdoSelect'/>

Thanks All

这篇关于控件ID找不到的AsyncPostBackTrigger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 02:14