But I can not find how to fix it in this application.
This is the code currently running..
void viewTickets()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(_myDomain + "/requests.xml"); // working for - rules/651263.xml
request.Method = "GET";
request.Credentials = new NetworkCredential(_Username, _Password);
request.ContentLength = 0;
HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(resp.GetResponseStream());
string tmp = reader.ReadToEnd();
XDocument Xdoc = XDocument.Parse(tmp);
//Run query
var result = (from etickets in Xdoc.Descendants("record")
select new MyModel
{
eNiceId = _myDomain + "/records/" + etickets.Element("nice-id").Value,
Subject = etickets.Element("subject").Value,
Status = GetTicketStatus(etickets.Element("status-id").Value)
,Description = etickets.Element("description").Value
}).ToList();
if (!IsPostBack)
{
//ViewState["dt"] = result; // I have commented this line in my running code
}
GridView1.DataSource = result; //ViewState["dt"]; If I use ViewState then it is not working here.
GridView1.DataBind();
}
Please can you advice me why I am getting this error?
System.NullReferenceException: Object reference not set to an instance of an object.
at XXXX.View.b__1(XElement etickets)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at XXXXX.viewTickets()
at XXXX
Please can you advice me why I am getting this error?
System.NullReferenceException: Object reference not set to an instance of an object.
at XXXX.View.b__1(XElement etickets)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at XXXXX.viewTickets()
at XXXX
Thanks!
I hope that you can use Skynet to upload your proj and so as to let me see it, will you?
From your codes I think your url is something like "http://evolvelogic.zendesk.com/users.xml?query=maduranga001@gmail.com"。However
when I input this URL into address bar, it needs your username and password!So maybe the problem of permission of accessing the site that caused your problem。Please make sure that when you input the address into the address bar,you can fetch the whole,complete
xml contents!
username is the email address and I added the hard coded password in the code for testing. So there not be an issue with the permission. You can see username and the password in my code.
Please ask me if you want any info. I will send it to the private email then.
Did you get enough free time to check my code? If you can advice me for that, then that would be really appreciate.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get data from XML datatable
Nov 23, 2011 01:20 AM|LINK
Well, plz update your whole proj onto the Skynet, and I'll download to see if I've got free time.
Best reguards!
maduranga001
Member
162 Points
235 Posts
Re: get data from XML datatable
Nov 23, 2011 03:20 AM|LINK
Thanks !
I saw the same error in this page.
http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/8eb35bcc-a620-4b16-b7ba-68ecc5fde10a/
and here..
http://code.google.com/p/reader-notifier-mod/issues/detail?id=8
But I can not find how to fix it in this application.
This is the code currently running..
void viewTickets() { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(_myDomain + "/requests.xml"); // working for - rules/651263.xml request.Method = "GET"; request.Credentials = new NetworkCredential(_Username, _Password); request.ContentLength = 0; HttpWebResponse resp = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream()); string tmp = reader.ReadToEnd(); XDocument Xdoc = XDocument.Parse(tmp); //Run query var result = (from etickets in Xdoc.Descendants("record") select new MyModel { eNiceId = _myDomain + "/records/" + etickets.Element("nice-id").Value, Subject = etickets.Element("subject").Value, Status = GetTicketStatus(etickets.Element("status-id").Value) ,Description = etickets.Element("description").Value }).ToList(); if (!IsPostBack) { //ViewState["dt"] = result; // I have commented this line in my running code } GridView1.DataSource = result; //ViewState["dt"]; If I use ViewState then it is not working here. GridView1.DataBind(); }Tnx
Appreciate if you can advice.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get data from XML datatable
Nov 23, 2011 03:55 AM|LINK
Hello again:)
I want you to upload your whole complete proj onto Skynet, and then let me download to have a look……
Looking at codes I really cannot tell what's wrong with your problem…….
thanks again
maduranga001
Member
162 Points
235 Posts
Re: get data from XML datatable
Nov 23, 2011 04:07 AM|LINK
Only thing is you cant run it as one project.
But do you have any idea about that error?
Thanks for advices.
maduranga001
Member
162 Points
235 Posts
Re: get data from XML datatable
Nov 24, 2011 06:06 AM|LINK
Hello,
Please can you advice me why I am getting this error?
System.NullReferenceException: Object reference not set to an instance of an object.
at XXXX.View.b__1(XElement etickets)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at XXXXX.viewTickets()
at XXXX
Thanks!
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get data from XML datatable
Nov 24, 2011 06:12 AM|LINK
I hope that you can use Skynet to upload your proj and so as to let me see it, will you?
Best reguards!
maduranga001
Member
162 Points
235 Posts
Re: get data from XML datatable
Nov 24, 2011 06:16 AM|LINK
I have not used skynet. Please can you tell me the URL ? or i can email you the code. If I know the email. Thanks !
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get data from XML datatable
Nov 24, 2011 06:18 AM|LINK
I've sent you a private message, plz into the InputBox to see.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get data from XML datatable
Dec 01, 2011 04:45 AM|LINK
Hello:)
From your codes I think your url is something like "http://evolvelogic.zendesk.com/users.xml?query=maduranga001@gmail.com"。However when I input this URL into address bar, it needs your username and password!So maybe the problem of permission of accessing the site that caused your problem。Please make sure that when you input the address into the address bar,you can fetch the whole,complete xml contents!
Best reguards!
maduranga001
Member
162 Points
235 Posts
Re: get data from XML datatable
Dec 04, 2011 08:42 AM|LINK
Hello,
How are you?
username is the email address and I added the hard coded password in the code for testing. So there not be an issue with the permission. You can see username and the password in my code.
Please ask me if you want any info. I will send it to the private email then.
Did you get enough free time to check my code? If you can advice me for that, then that would be really appreciate.
Thank you very very much!
Tnx