Browse by Tags
All Tags »
C# (
RSS)
First step: check if the assembly is really in the bin folder. It’s there but you still get the error? There might be few reasons for the framework to fail when trying to load your assembly. To find the real one you can use nice tool from MS, called “ Fuslogvw.exe ” which is assembly binding log viewer you can use for your .NET application (it’s auto installed with VS). After opening this tool, start your application and wait for the exception to be thrown. go back to the tool, hit the refresh to...
This post is about how to serialize type with properties that are decorated with XmlIgnoreAttribute (or any other XmlAttribute) using the XmlSerializer. When we will try to serialize an instance of type that one or more of its properties marked with XmlIgnoreAttribute, it will be unsurprising to find out that those properties are not shown at the serialized XML. We could just remove the XmlIgnoreAttribute from those properties, but what if the entity type declaration is out of our project scope or...
When using the svcutil.exe in order to create WCF proxy, any reflected collection will be converted into System.Array by default. Good to know that this can be controlled using the svcutil.exe. You can define the output data type for collections using the "/ct:" keyword. For example, generating generic list collection (System.Collections.Generic.List<T>) will be done like that: svcutil.exe http://localhost/Services/Sample.svc?wsdl /ct:System.Collections.Generic.List`1 This brings...
When working on a large project with a lot of test methods, that each one of them might be under the responsibility of another developer, finding your own unit test methods in the endless list is just like finding a needle in a haystack. This can be easily become much simple. When creating unit test for a process, Visual Studio generates unit test method decorated with the TestMethodAttribute. Now, to “own” the unit test, just add new attribute named “ OwnerAttribute ” which specify the person responsible...
“Ajax client-side framework failed to load”. If you encountered with the error message above after login to your site and you're using the ASP.NET membership framework (and you verified that MS AJAX is properly installed), you can add the following configuration section to your web.config: < configuration > ... < location path ="ScriptResource.axd" > < system.web > < authorization > < allow users ="*" /> </ authorization > </ system.web...
I had a very annoying bug today. One of the pages at my web application raises its Page_Load event twice for some reason. At the first time, Page.IsPostBack = true, and false at the second time. One of the interesting things was that this wrong behavior described above was occurring only when browsing using Internet Explorer. Firefox wasn’t post back again (well, except if you right clicked the image and choose “View Image”, then it was posting back one more time, but not twice at a time). Go figure...
In our current project we are using the RadControls toolkit for ASP.NET AJAX from Telerik at the presentation layer. One of the controls we were used the most was the RadComboBox for its wide client side API, enables you to make changes at the client side without bothering the server with tasks like filling new list of items, remove some etc. I had few cascading combo boxes and I was using AJAX web-service to add items to the one depends on the other selected value on the client-side. Everything...
טפסי WebForms רבים המכילים שדות להזנת נתונים ע"י המשתמש, מכילים גם פקדי וולידציה שתפקידם לוודא את תקינות המידע שהוזן בשדות ע"י ה client. וולידציה יעילה מבצעת בדיקה בצד לקוח לפני שליחת הטופס לשרת ע"מ לחסוך round-trips מיותרים, של טפסים שלא מולאו בצורה תקינה. לפני שמתבצע Post-Back של ה form, נבדקים שדות הקלט ובמידה והכל תקין, יישלח הטופס לבדיקה נוספת בשרת ולאחמ"כ לביצוע הפעולה הרצוייה. במידה ויש לנו צורך לבצע בדיקות נוספות מלבד הבדיקות הרגילות, נוכל לקשור client-side event handler...
במצב שיש צורך לבטל (או לאפשר מחדש) את הוואלידציה על פקד מסויים דרך ה client-side, ניתן להשתמש ב Javascript בכדי לבצע זאת בקלות. Will Asrary מסביר בבלוג שלו איך עושים את זה . חשוב לשים לב שזה תקף ל client-side בלבד, ומבחינת ה server-side הפקדים עדיין enabled. פתרון אפשרי זה לשים hidden field עם ערך שאותו נקרא ב Page_Load ולפיו נעדכן את ה Validator.Enable בצד ה server. שימושי.
בעייה: כשעובדים עם הפקדים של MS AJAX Toolkit לעיתים קורה מצב שבעליית הטופס פקדים מסויימים, שאמורים לעלות במצב "collapsed" עולים "expanded" לחלקיק השניה ומיד נסגרים. בד"כ זה לא קורה והפקדים עובדים בסדר, אך הפעם היה לי צורך לשתול באופן דינמי alert של javascript שאומר שהנתונים עודכנו בהצלחה לאחר ביצוע פעולת שמירה. מכיוון שה alert עולה ב load של הטופס, חל עיכוב בטעינת ה form ובעצם מה שקרה זה שה CollapsiblePanel שלי, "נתקע" במצב "expanded" במקום "collapsed"...
לפני כמה ימים הייתה לי בעייה: ביצעתי פעולת עדכון נתוני משתמש ל Data Source, ולאחר בדיקה שהעדכון אכן בוצע, שתלתי js alert שהעדכון אכן בוצע בהצלחה. הבעיה הייתה שהסקריפט לא הופיע בדף אחרי העדכון, ובדיקה ב view source הראתה שהוא בכלל לא נשתל. מכיוון שהמערכת שלי מציגה נתוני משתמש לפי ID מה QueryString, לאחר יצירת משתמש חדש הייתי מבצע Response.Redirect ל URL + ה User ID החדש. מה שהיה קורה, זה שה alert היה נשתל בדף הישן, ואני הייתי נשלח לדף החדש. אז חשבתי, איך אני יכול לשתול JS alert בדף שאני רוצה לעבור...
היי כולם. בפוסט הזה נסביר איך ליצור דפי web בארכיטקטורת ASP.NET MVC (גירסת ה CTP 3 ). הקדמה ל ASP.NET MVC : ארכיטקטורת ה ASP.NET MVC מבצעת חלוקה באפליקציות ווביות בין ה UI לבין ה Data שאמור להיות מוצג בדפי אינטרנט, ע"י מידול ה Web Application שלנו לשלוש שכבות: Model, View And Controller. ה View אמור להציג את הנתונים בלבד. View לא מכיר שום מקור נתונים ולא מבצע שום מניפולציה על Data. תצוגה נטו. View אמור להיות "טיפש" ככל שניתן. ה Model מנהל את ה business logic של האפליקצייה ואת הגישה...