Custom WebControl : LoadPostData pas apellé
Bonjour.
Pour une raison qui m'échappe totalement, dans un WebControl personnalisé (public class MultipleUpload : WebControl, IPostBackDataHandler), quand je dé-commente les lignes (en commantaires) ci-dessous : la référence de mon WebControl disparait de Request et donc LoadPostData n'est pas appellé.
Je trouve ça fou, il doit y avoir une cause qui m'échappe.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#region IPostBackDataHandler
public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
{
return postCollection[postDataKey].Length > 0;
}
public void RaisePostDataChangedEvent()
{
var y = this.Page.Request.Files;
}
#endregion
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
var scriptMgr = ScriptManager.GetCurrent(this.Page);
if (scriptMgr == null)
{
scriptMgr = new ScriptManager()
{
EnablePartialRendering = true
};
this.Controls.Add(scriptMgr);
}
this.Page.PreLoad += new EventHandler((sender, args) =>
{
//if (!this.Page.IsPostBack)
//{
// this.Page.Form.Enctype = "multipart/form-data";
//}
});
} |
Vous comprenez l'erreur commise ?