Showing posts with label beta. Show all posts
Showing posts with label beta. Show all posts

Wednesday, March 28, 2012

Accessing control extender behaviors in javascript

Hi there,

I'm using the AJAX 1.0 Beta 2 extensions and the AjaxControlToolkit. I'm finding it extremely hard to access the behaviors associated with a given control. (I'd like to hook into the expandComplete event of an CollapsiblePanel).

I've tried using the following:

var cp = $get('IdOfMyCollapsiblePanel');
cp.get_behaviors()[0].add_expandComplete(MyHandlerFunction);

This results in an error with the get_behaviors() call.

Can anyone post an example of how to hook up a javascript method to an extenders event? (client-side)

I'd really appreciate it!

Jeremy

And here I go replying to myself...

I found the source of my problem. I was trying to set up the event handling in the pageLoaded event that is raised by the PageRequestManager, but the behaviors are not yet loaded at this time. Instead I hooked the Sys.Application.load event and everything works!

Jeremy

Monday, March 26, 2012

Accessing a WebService-Method

Hello, i was migrating from Atlas July-CTP to Beta 2.

Now get an error when i call my webservice from javascript and the message is talking about System.InvalidOepration and authentication failed,

but only when I mark the corresponding method with EnableSession= true. In Atals JulyCTP the same call worked fine. Is there maybe a change in security-model?

Did I forget something or a declarartion is not set right?

Can anybody explain?

Hallo Michael,

can you show us the code of youre WebService definition?

Servus
Klaus


Check to see if your Web service definition has the ScriptService attribute (http://ajax.asp.net/docs/mref/8bb8cdde-6050-e492-e72a-eed2242c213c.aspx).
I believe the CTP version didn't have this attribute.


using System;

using System.IO;

using System.Web;

using System.Collections;

using System.Collections.Generic;

using System.Threading;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Xml.Serialization;

using System.Web.UI.WebControls;

using Microsoft.Web.Script.Services;

[ScriptService]

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

publicclass VehicleDataService : System.Web.Services.WebService

{

This Method is accessible, because it's called from Ajax:AutoCompleteExtender

[WebMethod(EnableSession =true)]

publicstring[] GetColors(string prefixText,int count)

{

string[] autoCompleteColors =null;

//Ablauf analog zu oben lediglich für Color statt für Model/Manufacturer

User user = SessionData.User;

if (autoCompleteColors ==null)

{

autoCompleteColors = VehicleDataUtils.GetColorsAsStringList(user);

}

int index =Array.BinarySearch(

autoCompleteColors, prefixText,

newCaseInsensitiveComparer());

if (index <0)

{

index = ~index;

}

int matchingCount;

for (matchingCount =0; matchingCount < count

&& index + matchingCount < autoCompleteColors.Length; matchingCount++)

{

if (!autoCompleteColors[index + matchingCount].StartsWith(

prefixText,StringComparison.CurrentCultureIgnoreCase))

{

break;

}

}

String[] returnValue =newstring[matchingCount];

if (matchingCount >0)

{

Array.Copy(autoCompleteColors, index, returnValue,0, matchingCount);

}

return returnValue;

}

This method is'nt accessible, it's called from pure javascript in a javascript-source file.

///<summary>

/// Setzt den aktuellen Hersteller (Name)

///</summary>

///<param name="input">Name des Herstellers</param>

[ScriptMethod]

[WebMethod(EnableSession =true)]

publicvoid SetActualManufacturer(string input)

{

SessionData.VehiclePageManufacturer = input;

}

}


Hello Michael,

maybe i'm wrong, but for me is VOID in a webservice a "not so god idee". You get absolut no response from this methode. It's not better to create an object with a returnvalue and react to the returnvalue?

It's only a idee.


The web service code seems OK. I don't know exactly how you're invoking the web service.
As you described, probably you don't have an aspx page with service reference configured using this web service. Adding a service reference to your page, makes AJAX download or include in the web page the proxy code (depending on the parameters you provide).
Check the proxy code that your service generates and see if it helps you (you can check that looking athttp://yourserverver/yourService.asmx/js - you just include /js after your web service address).

HTH,

Maíra

Saturday, March 24, 2012

Access a server-side control from JavaScript in beta 2

Sorry if this has been asked already, I tried search but no luck.

Okay, I have a server-side control defined as


<asp:Textbox id="textboxonserver" runat="server" />

What I want to achieve is to set the value of this control from client side javascript. document.getElementById("textboxonserver") won't work since the real id on page is something like ctrl$palceholder$textboxonserver. Tried $find, still nothing.

I know I can get the value by doing something like


My.prototype = {

_textboxid: null

...


Then set the textboxid = this.textboxonserver.ClientID inside the pageload() loop. But isn't this a bit overkill just for that purpose.

Thanks

nvm...i found the answer myself:

inside my javascript I can actually do this:

var txtboxid = "<%= textboxonserver.ClientID %>";

then use document.getElementById(txtboxid) to get the object in DOM tree. Just not sure if this is the elegant way to do this although it works..


ugh...sorrySad problem still stands..

A simple question: Do webservices work with the beta?

I can't seem to get of my webservice to work. All I get is object undefined. I have javascript that gets triggered on an onblur() event which calls a webservice where the code is in another file. Nothing I do will get it to work. I've tried all the solutions I've found and still errors.

Same goes for cascadingdropdowns. It's like my webservice is invisible. I read the sticky about putting the webservice call in the aspx file and I did that but it still can't be found.

I find that the documentation is limited and what I do find, it seems to be written for experts. So, I guess for now, I have no option but to dump the path I'm on since it appears to me the code isn't ready for beta. Too many issues. Not enough documentation and examples.

Very frustrated!

Hi jax67, can we see the webservice class and the javascript function that calls it? Also the error message that you are getting. Maybe I can help. I used cascadingdropdowns a lot too, it was very frustated at first, but then I figured it out. So, everything is all good now.

Thanks AW - I am so frustrated :( The first file is in a folder called Maint (off of the root) and the webservice asmx file is in the root. The code for the webservice is in app_code.

Here is the code that has the javascript call. The onblur is what calls the javascript and that part works. It's the actual call to the service that fails. I put an alert before the call and the alert is displayed. A javascript error occurs after I dismiss the alert. I do not have the alert code in the following code files.

Thank you for any help you can provide. I really do appreciate it...

Dave

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Amendment.aspx.cs" Inherits="Maint_Amendment" Title="Add A New Contract Amendment"
EnableEventValidation="false" %>
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<ajax:ScriptManager ID="sm" runat="server" EnablePartialRendering="True">
<Services>
<ajax:ServiceReference Path="../ContractService.asmx"/>
</Services>
</ajax:ScriptManager>
<script type="text/javascript" language="javascript">
function AddDates_click()
{
// Get the values necessary to pass to the webservice
var startDate = $get('<%= txtStartDate.ClientID %>').value;

var periodInYears = $get('<%= txtPeriodYears.ClientID %>').value;
if (periodInYears == "") periodInYears = "0";

var periodInMonths = $get('<%= txtPeriodMonths.ClientID %>').value;
if (periodInMonths == "") periodInMonths = "0";

if (startDate != "")
{
// Show the progress and resize the textbox
document.getElementById('calculating').style.display = '';
$get('<%= txtExpirationDate.ClientID %>').style.width = '90%';
// Make the call to the webservice
alert("Before Call...");
var x = ContractService.CalculateExpirationDate(startDate, periodInYears, periodInMonths, OnComplete, OnTimeout);
}

return false;
}
function OnComplete(result)
{
$get('<%= txtExpirationDate.ClientID %>').value = result;
document.getElementById('calculating').style.display = 'none';
$get('<%= txtExpirationDate.ClientID %>').style.width = '98%';
}
function OnTimeout(result)
{
document.getElementById('calculating').style.display = 'none';
$get('<%= txtExpirationDate.ClientID %>').style.width = '98%';
}
</script>
<ajax:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<img src="http://pics.10026.com/?src=../images/spinner.gif" />
</ProgressTemplate>
</ajax:UpdateProgress>
<ajax:UpdatePanel ID="upAmendment" runat="server">
<ContentTemplate>
<table align="center" border="1" bordercolor="#000000" cellpadding="4" style='width: 50%;
border-collapse: collapse">
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label2" runat="server" SkinID="bold" Text="Amendment Num"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtAmendmentNumber" runat="server" MaxLength="10" ReadOnly="True"></asp:TextBox><br />
<asp:TextBox ID="txtContract" runat="server" ReadOnly="True" Visible="False"></asp:TextBox></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="lblStartDate" runat="server" SkinID="bold" Text="Start Date"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtStartDate" runat="server" MaxLength="15" onblur="return AddDates_click()"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtStartDate"
Display="Dynamic" ErrorMessage="This field is required"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regStartDate" runat="server" ControlToValidate="txtStartDate"
Display="Dynamic" ErrorMessage="Invalid Date Format"></asp:RegularExpressionValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label3" runat="server" SkinID="bold" Text="Period (Years)"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtPeriodYears" runat="server" MaxLength="3" onblur="return AddDates_click()"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RangeValidator ID="rngYears" runat="server" ControlToValidate="txtPeriodYears"
Display="Dynamic" ErrorMessage="Invalid Value" MaximumValue="100" MinimumValue="1"
Type="Integer" SetFocusOnError="True"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label4" runat="server" SkinID="bold" Text="Period (Months)"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtPeriodMonths" runat="server" MaxLength="2" onblur="return AddDates_click()"
AutoCompleteType="Disabled"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtPeriodMonths"
Display="Dynamic" ErrorMessage="Invalid Value" MaximumValue="11" MinimumValue="0"
SetFocusOnError="True" Type="Integer"></asp:RangeValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label5" runat="server" SkinID="bold" Text="Expiration Date"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtExpirationDate" TabIndex="-1" runat="server" MaxLength="15"></asp:TextBox>
<span id="calculating" style='display: none;'>
<img src="http://pics.10026.com/?src=../images/spinner.gif" /></span>
</td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label11" runat="server" SkinID="bold" Text="Class"></asp:Label></td>
<td class="alt">
<asp:DropDownList ID="ddlClass" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="reqClass" runat="server" ControlToValidate="ddlClass"
Display="Dynamic" ErrorMessage="This field is required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label12" runat="server" SkinID="bold" Text="Type Of"></asp:Label></td>
<td class="alt">
<asp:DropDownList ID="ddlType" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="reqType" runat="server" ControlToValidate="ddlType"
Display="Dynamic" ErrorMessage="This field is required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label6" runat="server" SkinID="bold" Text="Consideration"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtConsideration" runat="server" MaxLength="10" AutoCompleteType="Disabled"></asp:TextBox>
<asp:RangeValidator ID="rngConsideration" runat="server" ControlToValidate="txtConsideration"
Display="Dynamic" ErrorMessage="Invalid Value" MaximumValue="999999999" MinimumValue="0"
SetFocusOnError="True" Type="Double"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label7" runat="server" SkinID="bold" Text="Percent of Credit"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtPercentCredit" runat="server" MaxLength="30" AutoCompleteType="Disabled"></asp:TextBox>
<asp:RangeValidator ID="rngPercentCredit" runat="server" ControlToValidate="txtPercentCredit"
Display="Dynamic" ErrorMessage="Invalid Value" MaximumValue="100" MinimumValue="0"
SetFocusOnError="True" Type="Double"></asp:RangeValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label8" runat="server" SkinID="bold" Text="Credit Type"></asp:Label></td>
<td class="alt">
<asp:DropDownList ID="ddlCreditType" runat="server" DataTextField="LOV_ITEM" DataValueField="LOV_VALUE">
</asp:DropDownList></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label9" runat="server" SkinID="bold" Text="Carry Forward (Years)"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtCarryForward" runat="server" MaxLength="2" AutoCompleteType="Disabled"></asp:TextBox>
<asp:RangeValidator ID="rngCarryForward" runat="server" ControlToValidate="txtCarryForward"
Display="Dynamic" ErrorMessage="Invalid Value" MaximumValue="100" MinimumValue="0"
SetFocusOnError="True" Type="Integer"></asp:RangeValidator></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label10" runat="server" SkinID="bold" Text="Assignable ?"></asp:Label></td>
<td class="alt">
<asp:RadioButtonList ID="optAssignable" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="lblEffectivityDate" runat="server" SkinID="bold" Text="Effectivity Date"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtEffectivityDate" runat="server" AutoCompleteType="Disabled" MaxLength="15"
onblur="return AddDates_click()"></asp:TextBox>
<asp:RegularExpressionValidator ID="regEffectivityDate" runat="server" ControlToValidate="txtEffectivityDate"
Display="Dynamic" ErrorMessage="Invalid Date Format"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="reqEffectivityDate" runat="server" ControlToValidate="txtEffectivityDate"
Display="Dynamic" ErrorMessage="This field is required"></asp:RequiredFieldValidator></td>
</tr>
</table>
<ajaxToolkit:CascadingDropDown ID="cddClass" runat="server" Category="Class" PromptText="Select a Class"
ServicePath="../ContractService.asmx" ServiceMethod="GetClasses" TargetControlID="ddlClass" Enabled="true" />
<ajaxToolkit:CascadingDropDown ID="cddType" runat="server" Category="Type" PromptText="Select a Type"
ServicePath="../ContractService.asmx" ServiceMethod="GetTypes" TargetControlID="ddlType" ParentControlID="ddlClass" Enabled="true" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmPeriodYears" runat="server" TargetControlID="txtPeriodYears" WatermarkCssClass="WaterMark" WatermarkText="Terms in years" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmPeriodMonths" runat="server" TargetControlID="txtPeriodMonths" WatermarkCssClass="WaterMark" WatermarkText="Terms in months" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmStartDate" runat="server" TargetControlID="txtStartDate" WatermarkCssClass="WaterMark" WatermarkText="Contract Start Date" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmConsideration" runat="server" TargetControlID="txtConsideration" WatermarkCssClass="WaterMark" WatermarkText="Amount paid or units mined in consideration" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmPercentCredit" runat="server" TargetControlID="txtPercentCredit" WatermarkCssClass="WaterMark" WatermarkText="% of credit received from payment" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmCarryForward" runat="server" TargetControlID="txtCarryForward" WatermarkText="Period in years credits may be carried forward" WatermarkCssClass="WaterMark" />
<ajaxToolkit:TextBoxWatermarkExtender ID="wmEffectivityDate" runat="server" TargetControlID="txtEffectivityDate" WatermarkCssClass="WaterMark" WatermarkText="When does this amendment take affect" />
</ContentTemplate>
</ajax:UpdatePanel>
<asp:Panel runat="server" ID="pnlReasonForEdit" SkinID="reasonforedit">
<br />
<table align="center" border="1" bordercolor="#000000" cellpadding="4" style='width: 50%;
border-collapse: collapse">
<tr>
<td class="label" style='width: 30%'>
<asp:Label ID="Label1" runat="server" SkinID="bold" Text="Reason for Edit"></asp:Label></td>
<td class="alt">
<asp:TextBox ID="txtReasonForEdit2" runat="server" MaxLength="2000" TextMode="MultiLine"
Rows="2"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqReasonForEdit" runat="server" ControlToValidate="txtReasonForEdit2"
Display="Dynamic" ErrorMessage="A reason must be entered" SetFocusOnError="True"></asp:RequiredFieldValidator></td>
</tr>
</table>
</asp:Panel>
<p align="center">
<asp:Button ID="cmdSave" runat="server" OnClick="cmdSave_Click" Text="Save" />
<asp:Button ID="cmdCancel" runat="server" CausesValidation="False" OnClick="cmdCancel_Click"
Text="Cancel" />
</p
<script type="text/javascript">
var styleToSelect;
function onOk() {
//$get('Paragraph1').className = styleToSelect;
}
</script
<asp:Panel ID="Panel1" runat="server" Style='display: none' Width='65%' SkinID='ReasonHeader'>
Please provide a reason for the edit
<asp:Panel ID="pnlBody" runat="server" SkinID="ReasonBody" Style='margin: 5px;'>
<br />
Enter the reason for editing this Amendment:
<asp:TextBox EnableTheming="false" runat="server" ID="txtReasonForEdit" TextMode="multiLine"
Width="96%" Rows="5"></asp:TextBox>
<br />
<br />
<center>
<asp:Button ID="OkButton" runat="server" Text="OK"></asp:Button>
<asp:Button ID="CancelButton" runat="server" Text="Cancel"></asp:Button>
</center>
<br />
</asp:Panel>
</asp:Panel>
</asp:Content>

Here is the Webservice file:

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using AjaxControlToolkit;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Web.Script.Services;

/// <summary>
/// Summary description for ContractService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[Microsoft.Web.Script.Services.ScriptService()]
public class ContractService : System.Web.Services.WebService {

public ContractService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string GetNextContractSequence(string contract)
{
// ---------------------------
// Author: dzangger
// Company: Huber
// Date: 8/4/2006
// Time: 12:06
// Procedure Name: GetNextContractSequence
// Purpose: Get the next available sequence number for contract
// Parameters:
// - contract (string)() :
// ---------------------------
return contract.ToUpper() + CMSDB.GetNextContractSequence(contract.ToUpper());
}

[WebMethod]
public string DoesContractExist(string contract)
{
bool b = CMSDB.DoesContractExist(contract);

if (b)
return "~" + contract.ToUpper();
else
return contract.ToUpper();
}

[WebMethod]
public string GetIndexValue(string index, string beginDate, string endDate)
{
try
{
DateTime d = Convert.ToDateTime(beginDate);
d = Convert.ToDateTime(endDate);
}
catch (Exception)
{
return "";
}

return CMSDB.GetIndexValueFromDateRange(index, beginDate, endDate);
}

[WebMethod]
public string CalculateExpirationDate(string startDate, string years, string months)
{
// ---------------------------
// Author: dzangger
// Company: Huber
// Date: 8/3/2006
// Time: 13:21
// Procedure Name: CalculateExpirationDate
// Purpose: Adds a number of years and months to a given date
// Parameters:
// - startDate (string)() :
// - years (string)() :
// - months (string)() :
// ---------------------------
try
{
int iYears = 0, iMonths = 0;

try
{
iYears = Convert.ToInt16(years);
}
catch (Exception)
{
iYears = 0;
}

try
{
iMonths = Convert.ToInt16(months);
}
catch (Exception)
{
iMonths = 0;
}

DateTime date = Convert.ToDateTime(startDate);

if (iYears > 0)
date = date.AddYears(iYears);

if (iMonths > 0)
date = date.AddMonths(iMonths);

return date.ToShortDateString();
}
catch (Exception)
{
return "";
}
}

[WebMethod]
[Microsoft.Web.Script.Services.ScriptMethod()]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetIndexTypes(string knownCategoryValues, string category)
{
// ---------------------------
// Author: david.zangger
// Company: Huber
// Date: 10/13/2006
// Time: 07:27
// Procedure Name: GetIndexTypes
// Purpose: Gets the indexes and their types
// Parameters:
// - knownCategoryValues (string)() :
// - category (string)() :
// ---------------------------
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

IDataReader reader = CMSDB.GetIndexesAndIndexTypes();

while (reader.Read())
{
string classId = reader[0].ToString();
string index = reader[1].ToString();
values.Add(new CascadingDropDownNameValue(classId, index));
}

reader.Close();

return values.ToArray();
}

[WebMethod]
[Microsoft.Web.Script.Services.ScriptMethod()]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetIndexSeries(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

StringDictionary sd = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);

if (sd.ContainsKey("Index"))
{
IDataReader reader = CMSDB.GetSeriesIds(sd["Index"].ToString());

while (reader.Read())
{
string series = reader[0].ToString();
values.Add(new CascadingDropDownNameValue(series, series));
}

reader.Close();

return values.ToArray();
}
else
return null;
}

[WebMethod]
[Microsoft.Web.Script.Services.ScriptMethod()]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetClasses(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

IDataReader reader = CMSDB.GetContractClasses();

while (reader.Read())
{
string classId = reader[0].ToString();
values.Add(new CascadingDropDownNameValue(classId, classId));
}

reader.Close();

return values.ToArray();
}

[WebMethod]
[Microsoft.Web.Script.Services.ScriptMethod()]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetTypes(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

StringDictionary sd = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);

if (sd.ContainsKey("Class"))
{
IDataReader reader = CMSDB.GetContractTypes(sd["Class"].ToString());

while (reader.Read())
{
string classId = reader[1].ToString();
string desc = reader[0].ToString();
values.Add(new CascadingDropDownNameValue(desc, classId));
}

reader.Close();

return values.ToArray();
}
else
return null;
}
}

I seem to have it working. I created a new website (using the CTP version) and then used the web.config from that project. I migrated my appsettings and an Oracle assembly and then moved my webservice in the folder where the files calling it resides. For now, I'm going to leave it as it is.

Thanks AW for your assistance!

dave

Wednesday, March 21, 2012

A question about Beta 1 and Beta2

I have downloaded the beta1 from the ajax.asp.net,and it includes 3 dll files:AJAXExtensionsToolbox.dll,Microsoft.Web.Extensions.Design.dll,Microsoft.Web.Extensions.dll

when the ajax 2 was published, I download it and refresh the beta 1 use it.

it run all ok in my computer.

I copy the source file to another computer,and set up ajax beta 2 at that computer.

it run ok, too,but when I choose the designer,the ajax controls were all error.

Don't do that, make sure you uninstall beta1 from you developer computer and then install beta 2, even coping the file does not work as the installer adds the files into the GAC

oh,sorry,I describe it not clearly.

I don't use copy.

I unnitall the beta 1 and set up the beta 2 .

what should I do?

thank u for your reply.


What exactly do you mean by what do you now?

Are you experiencing errors with the previous Ajax App? Recompile and programming should come as normal.. we are a little confused by the what to do now...


If you are missing the Intelissense, some have reported that changing the web.config entries to reference something like ajax instead of asp.. provides it... Others working with MasterPages find as long as the master page is open in the designer it works.. see my blog entry ontech-review.org for web.config entries and other install tips...

Check you web config to make sure all is resgistered for the Beta 2 :

http://alpascual.com/blog/al/archive/2006/10/24/Manually-upgrading-from-Atlas-to-ASP.NET-2.0-Ajax.aspx


OK.

the ajax beta 1:I downloat and install it.the default file include files:AJAXExtensionsToolbox.dll,Microsoft.Web.Extensions.Design.dll,Microsoft.Web.Extensions.dll

and the ajax beta 2: in another computer( it have never installed the beta 1,it is pure).I install the beta 2 directly.

but the default file noly inluce Microsoft.Web.Extensions.dll.the vs.net toolbox have no ajax control.

I add ajax control into toolbox.and add it to a website.

the website run ok.but the control response error in the design view.

I have modified the pre from asp to ajax.

thank you for your reply.


albertpascual,thank you for your reply.but the link I can't open.
What error do you get opening the link?