[RESOLVED]AjaxFileUpload Inside A Repeater

My .aspx page is like this :

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
     <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource4" OnItemCommand="Repeater1_ItemCommand">
        <HeaderTemplate>
            <table ID="Table1">
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="SqlDataSource6" DataTextField="WPName" DataValueField="WPName"></asp:BulletedList>
                    <asp:Button ID="Button2" runat="server" Text="Add KKP" CommandName="AddKKP"/>
                    <asp:Panel ID="Panel1" runat="server" Visible="false">
                        <ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server"></ajaxToolkit:AjaxFileUpload>
                    </asp:Panel>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
            </ContentTemplate>
    </asp:UpdatePanel>

how i declare codeBehind for AjaxFileUpload inside a repeater ? should i use FindControl ? how to throw CommandName from AjaxfileUpload upload button ?

my codeBehind :

protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
                       
            if (e.CommandName == "AddKKP")
            {
                Panel myPanel = (Panel)e.Item.FindControl("Panel1");
                myPanel.Visible = true;
            }
	}

Any sugestions ?

Thanks for your help.

Best Regards.

Hi,

Please refer to the example at:

http://forums.asp.net/p/1603720/4091630.aspx#4091630 

hi,

you can refer to blew code to get AjaxFileUpload.you can try it and test it.

private void getControl()
    {
        foreach (RepeaterItem item in Repeater1.Items)
        {
            Panel pnl = item.FindControl("Panel1") as Panel;
            AjaxControlToolkit.AjaxFileUpload af = (AjaxControlToolkit.AjaxFileUpload)pnl.FindControl("AjaxFileUpload1");
        
        }
   }

Hope this helps!

 

Leave a Reply