שלום חברים
היום נתבקשתי לחקור בעיה מוזרה , כשאנשים
מנסים להעלות קבצים מרובים באמצעות פקד ActiveX, שבו הם יכולים לגרור ולשחרר
קבצים או לבחור קבצים מרובים . התחלתי לקבל "Object
reference not set to an instance of an object" .
הדבר המוזר הוא שזה הופיע רק באתרים מסוימים
ועל כמה מחשבים (עשיתי ניסוי והרמתי תת אתר מסוג "אתר צוות עם Master
Page Defaultי ולא הייתה בעיה להעלות קבצים מרובים). בעודי
מתעסק בחקירת הבעיה שמתי לב שזה באמת קרה רק באתרים שבו אני משמש בדף ראשי מותאם אישית.
המחשבה הראשונית שלי הייתה שזה היה משהו לא חוקי עם פקדי HTML או חסרים delegate controls - אבל הכל היה
בסדר גמור.
על ידי בדיקת הקוד בדפים הראשיים מותאמים
אישית מצאתי את אלמנט קלט מסוג Button ללא
ערך AccessKey .
כל האלמנט מסוג כפתור חייב להיות עם ערך AccessKey מוגדר שאינו ריק. החוסר בערך AccessKey הייתה הדבר שגרם ל NullReferenceExceptionבהעלאת
מרובת קבצים. במקרה זה היה לי כמה אלמנטי קלט מסוג כפתור ללא כל תכונות AccessKeyבדף
הראשי שלי.
יחד עם זאת ברגע שהוספתי את תכונה AccessKey עם ערך שאינו ריק
העלאת קצים מרובים עבדה כמו קסם. שימו לב שהגדרת AccessKey = " " גורמת לאותה
שגיאה, אתם צריכים להגדיר את הערך עבורו, למשל ; AccessKey = " _ " .
בהצלחה !
רון נס.
============================================================================================================================================================================================================================================================
Hello Friends
Today I was asked to explore
strange Problem, It's when people are
trying to upload multiple files using the ActiveX control, where they can drag
and drop files or select multiple files. I started receiving "Object
reference not set to an instance of an object" exceptions from the STSUpld control.
The strange thing is
that this only appeared on some sites and on some computers. After some
fiddling around I noticed that it actually only happened on sites where I used
a custom master page. My initial thought was that this had something to
do with invalid HTML or missing delegate controls - but everything was just
fine.
By
inspecting the code on the Custom Master Page I found an input element of
the type button without AccessKey value.
All input element of the type button must have the AccessKey value
set to non empty the control iterates through all input
elements looking for the AccessKey to find the OK and Cancel buttons. The
point above was the thing that caused the NullReferenceException in the
multiple upload control. In this case I had a few input elements with the type
button without any AccessKey attributes in my master page.
Nevertheless
once I added the AccessKey attribute with a non-empty value the upload worked
like a charm. Note that setting AccessKey="" causes the
same exception, you need to set a value for it for instance; AccessKey="_".
Good
Luck :)
Ron
Ness.
No comments:
Post a Comment