I have some stored proc.s that get data from DB.
I made some data access layers classes to get the data from the sql db
I have some Xml files that should be filled with this data.
I’m supposed to link between them using aspx pages.
Now, I want to know how can I read data at the aspx page from the xml file to send it to the server, and how can I write data from the db to the xml files.
I used to use json, but is there a method in which I can send and receive data without using json & just using XML ?
This is my XML File:
<allNews>
<news>
<gNews>
<flag>List of categories IDs this article linked to</flag>
<title>news title goes here</title>
<description>news description goes here</description>
<date>news date goes here</date>
</gNews>
</news>
This is the function that retrieves a list from the database:
XDataContext XDB = new XDataContext();
public getCategoryContentListResult GetCategoryContentList(int contentID)
{
return XDB.getCategoryContentList(contentID).SingleOrDefault<getCategoryContentListResult>();
}
I want to know how can I connect these two files using aspx.
When I used Json I used to do this: [I read data from an ajax call at the javascript file)
private getCategoryContentListResult GetCategoryList()
{
int ContentID = int.parse(Request.QueryString["country"]);
int res = getCategoryContentListResult(ContentID);
JsonResponse = JsonConvert.SerializeObject(res);
}
Response.Clear();
Response.ContentType = "application/json";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write(Request.QueryString["jsoncallback"] + "(" + JsonResponse + ");");
Response.End();
Now I can’t use Json, I just have to use XML. SO is there some method to do it ?
Try modifying the below code accordingly
Hope this will help.