I am trying to use a RadUpload Control, however, on any button click the page postbacks. To get around this I am trying to use a updatePanel and placing the button in the updatePanel, so that only a partial postback occurs. The reason for this is that the RadUpload Control loses it’s value on postback. I am dynamically creating all the controls, and being a beginner to asp.net and C# this is tricky for me.
Here is the code:
Button aButton = new Button();
aButton.ID = newControls[1].ID + "_Button";
aButton.Click += new EventHandler(aButton_Click);
aButton.UseSubmitBehavior = false;
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = aButton.ID;
trigger.EventName = "Click";
UpdatePanel container = new UpdatePanel();
container.ID = newControls[1].ID + "_Container";
container.ChildrenAsTriggers = true;
container.UpdateMode = UpdatePanelUpdateMode.Conditional;
container.Triggers.Add(trigger);
container.ContentTemplateContainer.Controls.Add(aButton);
tcControl.Controls.Add(container);
static void aButton_Click(object sender, EventArgs e)
{
// Do Something
}
I know i’m probably doing something very wrong haha, but any advice would be great. Thanks!
I have solved this problem by completely removing this upload control from the page and instead replacing it with a button that loads an external upload page(just a popup). I was unable to find a solution for what I originally intended, but my current solution is all I have for now.