Click here to Skip to main content
16,018,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried using trigger .
Error message as below

A control with ID 'btnupload' could not be found for the trigger in UpdatePanel..

How to find the button control ID, or is there any other way.

Backend Code

C#
string excelPath = Server.MapPath("~/Files/") + Path.GetFileName(FileUpload1.PostedFile.FileName);
        FileUpload1.SaveAs(excelPath);

        string conString = string.Empty;
        string extension = Path.GetExtension(FileUpload1.PostedFile.FileName);



ASPX Code

<updatepanel>
XML
<asp:TabPanel ID="TabPanel7" runat="server" HeaderText="TabPanel7">
                    <ContentTemplate>
                        <br />
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                        <asp:Button ID="btnupload" runat="server" OnClick="Button1_Click" Text="Button" />

                    </ContentTemplate>

                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnupload" />
        </Triggers>
    </asp:UpdatePanel>
Posted
Updated 6-Jun-14 0:12am
v2
Comments
Kundan1984 6-Jun-14 12:53pm    
Thanks DamithSL. You rock! I was wondering whole day and here comes the hero.......

1 solution

in your page load method do as below
C#
protected void Page_Load(object sender, EventArgs e)
{
    Page.Form.Attributes.Add("enctype", "multipart/form-data");
    ScriptManager scriptManager = ScriptManager.GetCurrent(this);
    if (scriptManager != null)
    {
        scriptManager.RegisterPostBackControl(btnupload);
    }
}


remove the Triggers from aspx page. do it from the code behind
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900