Finishing an ASP.NET AJAX-based Application - Modifying the Related Contents in the CodeFile
(Page 4 of 4 )
Now, with the above modification of the two DropDownList controls, we have to rebuild the corresponding parts within the codeFile-jobsearch.aspx.cs. First, open file jobsearch.aspx.cs and comment out (or delete) the two original methods-FillCountries() and FillStates() and all the invocations to them. Second, inside function Page_Load, the initial mode to operate with the two DropDownList controls have to be changed. The final code snippet looks like this:
//omitted…
//ddlCountry.SelectedIndex = s.CountryID;
//FillStates();
//ListItem li= ddlState.Items.FindByValue(s.StateID.ToString());
//if (li != null)
//{
// ddlState.ClearSelection();
// li.Selected = true;
//}
cddCountry.SelectedValue = s.CountryID.ToString();
cddCity.SelectedValue = s.StateID.ToString();
As indicated in the above code, the part commented out is replaced with the two lines below. There are now two functions left to be reformed: the event handler btnMySearches_Click for the "Add to My Searches" button and the helper method named BindGrid used to bind the searching result to control GridView, respectively. However, for brevity, we'll omit them; please refer to the downloadable source code for details.
Conclusion
In this article, we've outlined the three possible patterns to construct a web application and examined the pros and cons of each solution. Subsequently, we focused on rebuilding a legacy ASP.NET 2.0 web application -- the famous Microsoft Job Site Starter Kit and put forward several tips in an attempt to ajaxify it. However, there is still much that can be improved in JSSK using MS AJAX, such as enhancing the MyFavorites.aspx page through client-side WebParts-related controls, and more. Altogether, with the effort being exerted by Microsoft to encourage more and more developer communities and third parties to join in, MS AJAX may become an excellent tool in constructing or reconstructing web 2.0 applications.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |