Posted on: 10/1/2012 1:18:51 AM | Views : 232

hi any help how can i create my fielupload dynamically. i have here my code but when every time click my button only one file uplaod was created. kindly help me. thanks
protected void b_add_Click(object sender, EventArgs e)
{

 int count = 0;
if (h_hid.Value != "")
{
count = Convert.ToInt16(h_hid.Value) + 1;
FileUpload fu_file = new FileUpload();
fu_file.ID = "fu" + count.ToString();
p_container.Controls.Add(fu_file);

}
else
{
count = Convert.ToInt16(h_hid.Value) + 1;
FileUpload fu_file = new FileUpload();
fu_file.ID = "fu" + count.ToString();
p_container.Controls.Add(fu_file);
}
count++;
}

<asp:Panel ID="p_container" runat="server">
</asp:Panel>
<asp:Button ID="b_add" runat="server" Text="Add" onclick="b_add_Click" />
<asp:HiddenField ID="h_hid" runat="server" Value="0" />


...

Go to the complete details ...