Reputation: 35
Thank you for everyone's help so far! Have had some really helpful answers on this site so far so am hoping for one more.
What I want to create is EXACTLY this, but i'm still having problems
http://www.webonweboff.com/widgets/ajax/ajax_linked_selection.aspx
I have copied the html and javascript word for word and saved that file as index.html (but obviously with open and close html and body tags)
The file I have called ajaxServer.aspx.cs has the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/javascript";
string id = Request.QueryString.Get("id");
string action = Request.QueryString.Get("action");
StringBuilder returnString = new StringBuilder();
/*
Retrieve the data based on values "id" and "action"
and build a response string in this format:
[{text:"...",
*
* value:"...",selected:false},
{text...}]
No final ";" is necessary
For example:
returnString.Append("[{text:\"California\",value:\"CA\",selected:false}," +
"{text:\"OH\",value:\"Ohio\",selected:false}," +
"{text:\"NY\",value:\"New York\",selected:true}]");
*/
Response.Write(returnString.ToString());
}
}
and the file I have called ajaxServer.aspx has the following code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="ajaxServer.aspx.cs" Inherits="_Default" %>
The other (.js) files I have downloaded and saved. When I run the .html file i get the following error:
error fetching data!
url:ajaxServer.asp
method:GET
params:action=state,culture=en-us
readyState:4
status:403
headers:Server: ASP.NET Development Server/10.0.0.0 Date: Sun, 19 Jun 2011 20:39:55 GMT X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 2126 Connection: Close
--> Any clues anyone? And once again - thank you for all the help in advance!
Upvotes: 0
Views: 183
Reputation: 1496
"(are you missing a using detective or an assembly reference?)" Means exactly what it says.
StringBuilder lives in the System.Text namespace.
So you need a
using System.Text;
declaration at the top of the class.
Upvotes: 0
Reputation: 212
I believe you want to change your ajaxServer.aspx file so that Inherits="_Default" instead of Inherits="widgets_ajax_ajaxServer".
Upvotes: 0