Showing posts with label standard. Show all posts
Showing posts with label standard. Show all posts

Wednesday, March 28, 2012

Difference between ASP.NET Website and ASP.NET Ajax-enabled Website

What are the differences between creating a standard ASP.NET Website and a 'special' ASP.NET AJAX-enabled website?

What are the differences VS.NET 2005 does behind the scenes?

The "ASP.Net Website" creates a default web site to create webb apps. the "ASP.Net Ajax-enabled website" will use another template and create a "normal" web site but with the required settings in web.config that is needed and a Web Form that already have the scriptmanager on the page (ScriptManager is the control that kind of "handles" all the Ajax fetures on the page) and a reference to the ASP.Net Ajax assembly.

VS 2005 don't do anything spec behind the scenes, more than using different templates that I describe above.

Wednesday, March 21, 2012

Default value in child CascadingDropDown

I'm using the standard technique for setting the default option in the Web service: result.Add(newCascadingDropDownNameValue(name, code, BLOCKED EXPRESSION

(expression is true only for the default option)

This technique ony works for the parent list, and doesn't do anything for the child list. In other words, when the selection on the parent list changes, and the child list gets populated via its Web service, setting the default option via the above technique doesn't actually do anything (the first option of the child element is always selected by default). What am I doing wrong?

Hi Tomers,

My understanding of your case is that you want to set a default value for DropDownList ,which is associated with a CascadingDropDown.

As far as I know, the returned value will add to it's child list instead of parent list. Here is the code section in CascadingDropDownNameValue.cs.

public CascadingDropDownNameValue(string name, string value, bool defaultValue)
{
this.name = name;
this.value = value;
this.isDefaultValue = defaultValue;
}

I have made a sample and it works fine on my local machine. Please see my sample which is using oledb:

[WebMethod]public CascadingDropDownNameValue[] GetCities(string knownCategoryValues,string category) { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);int stateID;if (!kv.ContainsKey("State") || !Int32.TryParse(kv["State"],out stateID)) {return null; } List myList =new List(); strSql ="SELECT * FROM tb_City WHERE StateID=" + stateID.ToString(); GetDr(strSql);while (myReader.Read()) {if (myReader["CityName"].ToString() =="Shanghai") { myList.Add(new CascadingDropDownNameValue(myReader["CityName"].ToString(), myReader["CityID"].ToString(),true)); }else { myList.Add(new CascadingDropDownNameValue(myReader["CityName"].ToString(), myReader["CityID"].ToString(),false)); } } myReader.Close();return myList.ToArray(); }

In your case, I think you should check your code and debug it step-by-step if necessary.

Best Regards,

Jonathan