Click here to Skip to main content
15,891,431 members
Home / Discussions / Web Development
   

Web Development

 
QuestionJohn Ray still relevant? (TCP/IP related) Pin
Mossmyr21-May-12 1:24
Mossmyr21-May-12 1:24 
QuestionNot able to Ajax post knockout (KO) data in XML format Pin
AumSingh20-May-12 6:38
professionalAumSingh20-May-12 6:38 
AnswerRe: Not able to Ajax post knockout (KO) data in XML format Pin
AumSingh23-May-12 23:52
professionalAumSingh23-May-12 23:52 
Questiontigrina lexikon ትግርኛ መዝገብ ቃላት seglelet.com Pin
mululer19-May-12 22:27
mululer19-May-12 22:27 
QuestionHow to display XML data using XSL in HTML? Pin
RedUnited18-May-12 1:35
RedUnited18-May-12 1:35 
AnswerRe: How to display XML data using XSL in HTML? Pin
berba19-May-12 6:44
berba19-May-12 6:44 
QuestionProblem with Knockout mapping of observable array. Pin
AumSingh18-May-12 0:04
professionalAumSingh18-May-12 0:04 
AnswerRe: Problem with Knockout mapping of observable array. Pin
AumSingh18-May-12 20:07
professionalAumSingh18-May-12 20:07 
I figured it out last night. Actually this was very basic mistake that I was making. I was trying to access an array after setting it to null. I will explain it how.

When result were returned that time GridHeaderModel and the IList Cells in it were defined i.e. were not null. That time ko.mapping was able to convert the model and create the model and arrary inside it. But when any ajax request were made wherein noo result was returned and GridHeaderModel was null, obviously the IList Cells was null too. That time ko.mapping did the same, the KO model that it updated, set GridHeaderModel to null too and the observable array Cells inside was no present which is as good as null. Now when I made another ajax request with some records returned, the ko.mapping tried to update the observable array Cells which did not exist (or was set to null) in KO model on the client, it failed. If instead of ajax it were fresh page load everything would have worked. So the solution is not to return any enumeration (those that will get converted to observable array) uninitialized to the client for KO model update. Hence when no record was to be returned I made sure that GridHeaderModel is not null and also made sure that the IList Cells is initialized though it did not contained any element. This fixed the problem.

This problem could be explaied with following example.

C#
public class Demo
{
    public IList<string> DemoArray;
}

public class DemoUser
{
    public void UseDemo()
        {
            var demoInstance = new Demo();
            demoInstance.DemoArray.Add("First Element");
        }
}


Here in the UseDemo() method we have initialized the class instance Demo but the IList DemoArray remains un-initialized. So when we try to access it runtime exception will be thrown. This is what was happening in my case. In first ajax response I was setting the observable array to null i.e. un-initializing it and then in next ajax response I was trying to access it.

modified 19-May-12 2:26am.

Questionhow can i bind data from excel file? Pin
heinhtataung16-May-12 23:09
heinhtataung16-May-12 23:09 
AnswerRe: how can i bind data from excel file? Pin
frostcox19-May-12 21:36
frostcox19-May-12 21:36 
AnswerRe: how can i bind data from excel file? Pin
frostcox25-May-12 11:08
frostcox25-May-12 11:08 
QuestionUse of Session states in SharePoint 2010 Pin
Athar Raza Faridi16-May-12 20:37
Athar Raza Faridi16-May-12 20:37 
QuestionMessage box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
berba16-May-12 3:15
berba16-May-12 3:15 
AnswerRe: Message box with 3 buttons Yes/NO/Cancel in ASP.Net Pin
Sandeep Mewara16-May-12 7:38
mveSandeep Mewara16-May-12 7:38 
QuestionEmails Sent by Window Service/C# Code are landing in spam in Gmail Pin
masterprogrammertech14-May-12 1:19
masterprogrammertech14-May-12 1:19 
AnswerRe: Emails Sent by Window Service/C# Code are landing in spam in Gmail Pin
Bernhard Hiller14-May-12 21:36
Bernhard Hiller14-May-12 21:36 
QuestionSubpages are not found. Pin
m_kukulka10-May-12 3:03
m_kukulka10-May-12 3:03 
AnswerRe: Subpages are not found. Pin
Bernhard Hiller10-May-12 4:25
Bernhard Hiller10-May-12 4:25 
QuestionWeb Crawling / Searching Pin
eddieangel9-May-12 6:08
eddieangel9-May-12 6:08 
AnswerRe: Web Crawling / Searching Pin
Bernhard Hiller9-May-12 21:20
Bernhard Hiller9-May-12 21:20 
QuestionFormat Date According to Regional Settings Pin
berba9-May-12 3:22
berba9-May-12 3:22 
AnswerRe: Format Date According to Regional Settings Pin
Richard MacCutchan9-May-12 4:31
mveRichard MacCutchan9-May-12 4:31 
AnswerRe: Format Date According to Regional Settings Pin
David Mujica9-May-12 4:35
David Mujica9-May-12 4:35 
GeneralHow to write code for Admin approve ! Pin
heinhtataung8-May-12 18:26
heinhtataung8-May-12 18:26 
GeneralRe: How to write code for Admin approve ! Pin
David Mujica9-May-12 4:30
David Mujica9-May-12 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.