Erreur lors d'un changement de page

EvilDef Messages postés 66 Date d'inscription vendredi 13 février 2004 Statut Membre Dernière intervention 19 mai 2006 - 7 mars 2005 à 17:38
EvilDef Messages postés 66 Date d'inscription vendredi 13 février 2004 Statut Membre Dernière intervention 19 mai 2006 - 8 mars 2005 à 11:25
lorsque je clique sur un bouton, mon projet ouvre la meme page avec un nouveau parametre (la c simple)
mais quand je saisie un champs, je clique une fois ca marche, et si je reremplie ce champs alors il bug et ne trouve plus un des mes boutons

Voila l'erreur, si quelqu'un connais ce probleme et ca solution merci de m'aider


An error has occurred because a control with auto-generated id '_ctl22' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: An error has occurred because a control with auto-generated id '_ctl22' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:


[HttpException (0x80004005): An error has occurred because a control with auto-generated id '_ctl22' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events.]
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +845
System.Web.UI.Page.ProcessRequestMain() +891

3 réponses

jesusonline Messages postés 6814 Date d'inscription dimanche 15 décembre 2002 Statut Membre Dernière intervention 13 octobre 2010 29
7 mars 2005 à 18:24
Tu peux nous donner le code provoquant cette erreur ?



tu charges tes controles dynamiquement je suppose ?

<hr>
Cyril - MCP ASP.net
Webmaster de : Hoshimi.CodeS-SourceS.fr
0
EvilDef Messages postés 66 Date d'inscription vendredi 13 février 2004 Statut Membre Dernière intervention 19 mai 2006
8 mars 2005 à 09:15
string borne = ((finfo.Length)/1000).ToString();
string borneMax;
bool test = true;


if(Request.Params["Max"] != null)
{
borneMax = Request.Params["Max"];
if(borneMax.Length < borne.Length)
test = false;
else
if(borneMax.Length == borne.Length && String.Compare(borneMax, borne)==-1)
test = false;
}


string borneMin;


if(Request.Params["Min"] != null)
{
borneMin = Request.Params["Min"];
if(borneMin.Length > borne.Length)
test = false;
else
if(borneMin.Length == borne.Length && String.Compare(borneMin, borne)==1)
test = false;
}



if(test)
{
laTable.Rows.AddAt(laTable.Rows.Count-1,unFichier);
}

En fait j'ai un formulaire qui affiche les fichier d'un repertoire, et je voulais faire 2 champs permettant a l'utilisateur de saisir une taille minimum et un taille maximum. pour faire une selection des fichiers. mais ce probleme arrive et il semble etre "aleratoire", en effet ca arrive pas a chaque fois (mais tres souvent) j'ai deja une compaison de chaine et int pas terrible mais j'ai un autre probleme quand je fais int.Parse(...) ou Int16. ou Int32. que je n'arrive pas a resoudre

Merci
0
EvilDef Messages postés 66 Date d'inscription vendredi 13 février 2004 Statut Membre Dernière intervention 19 mai 2006
8 mars 2005 à 11:25
c bon g plus le bug, mais me demander pas d'ou il vener je n'en sais rien

int saTaille = (int)(finfo.Length/1000);


int Ma = saTaille + 1 ;
if(Request.Params["Maxi"]!=null)
Ma = Int32.Parse(Request.Params["Maxi"]);


int mi = saTaille - 1 ;
if(Request.Params["Mini"]!=null)
mi = Int32.Parse(Request.Params["Mini"]);


if (saTaille >= mi && saTaille <= Ma)
{
nbFichier++;
tailleFichier += (int)finfo.Length;
laTable.Rows.AddAt(laTable.Rows.Count-1,unFichier);
}
0
Rejoignez-nous