Multiple Drop-Downs

J

John Straumann

Hi all:

I have a web form that has a login button, and then 2 drop downs and the
action I need is thus:

Login button is click, user is logged in and the first drop-down list is
populated
When the user makes a selection from the first drop-down list, the 2nd
drop-down list is populated
When the user makes a selection from the 2nd drop-down list, the record
corresponding to that selection is displayed.

All seems to work fine until I make a selection from the 2nd drop-down, then
I am getting an error:

Sys.Webforms.PageRequestManagerParserErrorException: The message received
from the server could not be parsed. Common causes for this error are when
the response is modified by calls to Response.Write(), response filters,
HttpModules, or server trace is enabled. Details: Error parsing near
'ue,true,true,true]}|<script language='ja"

I have no idea what that means!

Could this error be caused by the multiple-postbacks from the login and then
the population and selections from the drop-downs?

Can anyone make a suggestion as to how to fix this, or a better idea than 2
drop-downs?

Thanks all.

John.
 
J

John Straumann

Hi Mark:

Thanks for your reply, again! :)

The code is a bit long and includes lots of calls to the CRM web services,
but I have pasted relevant parts below. I am not calling an JScript at all,
so I am not sure where that error is coming from.

John.

public ArrayList alistSOWs = new ArrayList();

//Login button click method
//===============================================================================================
//===============================================================================================
protected void cmdLogin_Click(object sender, ImageClickEventArgs e)
{
string strAccountGuid = "";
try
{
//Initialize CRM web services============
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "StraumannGroup";

CrmService webservice = new CrmService();
webservice.Url =
"http://straumannsrvr2:5555/mscrmservices/2007/crmservice.asmx?WSDL&uniquename=MicrosoftCRM";
webservice.CrmAuthenticationTokenValue = token;
webservice.Credentials =
System.Net.CredentialCache.DefaultCredentials;

// Create Username condition
ConditionExpression userNameCondition = new ConditionExpression();
userNameCondition.AttributeName = "new_webusername";
userNameCondition.Operator = ConditionOperator.Equal;
userNameCondition.Values = new string[] { txtUsername.Text };

// Create password condition
ConditionExpression passwordCondition = new ConditionExpression();
passwordCondition.AttributeName = "new_webpassword";
passwordCondition.Operator = ConditionOperator.Equal;
passwordCondition.Values = new string[] { txtPassword.Text };

// Create the username filter
FilterExpression userNameFilter = new FilterExpression();
userNameFilter.Conditions = new ConditionExpression[] {
userNameCondition };

// Create the password filter
FilterExpression passwordFilter = new FilterExpression();
passwordFilter.Conditions = new ConditionExpression[] {
passwordCondition };

// Create the outer most filter to AND the username condition with the
other filters
FilterExpression outerFilter = new FilterExpression();
outerFilter.FilterOperator = LogicalOperator.And;
outerFilter.Conditions = new ConditionExpression[] {
userNameCondition, passwordCondition };
outerFilter.Filters = new FilterExpression[] { userNameFilter,
passwordFilter };

// Put everything together in an expression
QueryExpression qryExpression = new QueryExpression();
qryExpression.Criteria = outerFilter;
qryExpression.ColumnSet = new AllColumns();

// Set the table to query
qryExpression.EntityName = EntityName.account.ToString();

// Return all records
qryExpression.Distinct = false;

// Execute the query
BusinessEntityCollection retrieved =
webservice.RetrieveMultiple(qryExpression);
Panel pnlSubjects = new Panel();
if (retrieved.BusinessEntities.Length > 0)
{
account aAccount = (account)retrieved.BusinessEntities[0];
bFound = true;
guidAccountId = aAccount.accountid.Value;
strAccountName = aAccount.name;
strAccountGuid = aAccount.accountid.Value.ToString();
}

//Retrieve custoemr engagements for this account
#region retrieve
// Create the ConditionExpression.
ConditionExpression condition = new ConditionExpression();

//Set the condition for the retrieval to be when the RFP Guid on the
//RFP Sent record matches the RFP ID.
condition.AttributeName = "new_customerid";
condition.Operator = ConditionOperator.Equal;
condition.Values = new string[] { strAccountGuid };

// Create the FilterExpression.
FilterExpression filter = new FilterExpression();

// Set the properties of the filter.
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] { condition };

// Create the QueryExpression object.
QueryExpression query = new QueryExpression();

// Set the properties of the QueryExpression object.
//query.EntityName = EntityName.new_rfpsent.ToString();
query.EntityName = EntityName.new_customerengagement.ToString();
query.ColumnSet = new AllColumns();
query.Criteria = filter;

// Create the request object.
RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();

// Set the properties of the request object.
retrieve.Query = query;

// Retrieve the "Long List" of hotels that the RFP was sent to
//CRM Entity: new_rfpsent
RetrieveMultipleResponse retrievedEngagements =
(RetrieveMultipleResponse)webservice.Execute(retrieve);
drpProjects.Items.Add("Select...");
for (int i = 0; i <
retrievedEngagements.BusinessEntityCollection.BusinessEntities.Length; i++)
{
new_customerengagement nCE =
(new_customerengagement)retrievedEngagements.BusinessEntityCollection.BusinessEntities;
ListItem li = new ListItem(nCE.new_enagementtitle,
nCE.new_customerengagementid.Value.ToString());
drpProjects.Items.Add(li);
}
#endregion
}
catch (System.Web.Services.Protocols.SoapException soapEx)
{
}
catch (Exception ex)
{
}
}

//========================================================================================//========================================================================================//Get Statements of work method public void getSOWs(ref ArrayList aSOWS, string sPguid) { try { //Initialize CRM web services============ CrmAuthenticationToken token = new CrmAuthenticationToken(); token.AuthenticationType = 0; token.OrganizationName = "StraumannGroup"; CrmService webservice = new CrmService(); webservice.Url ="http://straumannsrvr2:5555/mscrmservices/2007/crmservice.asmx?WSDL&uniquename=MicrosoftCRM"; webservice.CrmAuthenticationTokenValue = token; webservice.Credentials =System.Net.CredentialCache.DefaultCredentials; // Create the ConditionExpression. ConditionExpression condition = new ConditionExpression(); //Set the condition for the retrieval to be when the RFP Guid on the //RFP Sent record matches the RFP ID. condition.AttributeName = "new_ceid"; condition.Operator = ConditionOperator.Equal; condition.Values = new string[] { sPguid }; // Create the FilterExpression. FilterExpression filter = new FilterExpression(); // Set the properties of the filter. filter.FilterOperator = LogicalOperator.And; filter.Conditions = new ConditionExpression[] { condition }; // Create the QueryExpression object. QueryExpression query = new QueryExpression(); // Set the properties of the QueryExpression object. //query.EntityName = EntityName.new_rfpsent.ToString(); query.EntityName = EntityName.new_statementofwork.ToString(); query.ColumnSet = new AllColumns(); query.Criteria = filter; // Create the request object. RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest(); // Set the properties of the request object. retrieve.Query = query; RetrieveMultipleResponse retrievedSOWs =(RetrieveMultipleResponse)webservice.Execute(retrieve); drpSOWs.Items.Add("Select..."); for (int i = 0; i <retrievedSOWs.BusinessEntityCollection.BusinessEntities.Length; i++) { new_statementofwork sow =(new_statementofwork)retrievedSOWs.BusinessEntityCollection.BusinessEntities; aSOWS.Add(sow); ListItem li = new ListItem(sow.new_name,sow.new_sowid.Value.ToString()); txtWorkItems.Text += sow.new_name + " " +sow.new_sowid.Value.ToString() + "\n"; drpSOWs.Items.Add(li); } } catch (System.Web.Services.Protocols.SoapException soapEx) { } catch (Exception ex) { } }//=======================================================================================//======================================================================================== protected void drpProjects_SelectedIndexChanged(objectsender, EventArgs e) { string strProjectGuid = drpProjects.SelectedValue; getSOWs(ref alistSOWs, strProjectGuid); }//=======================================================================================//======================================================================================== protected void drpSOWs_SelectedIndexChanged(object sender, EventArgs e) { try { new_statementofwork sow =(new_statementofwork)alistSOWs[drpSOWs.SelectedIndex - 1]; txtWorkItems.Text = sow.new_workitems; } catch (System.Web.Services.Protocols.SoapException soapEx) { } catch (Exception ex) { } }"Mark Rae [MVP]" <[email protected]> wrote in messagenews:#[email protected]...> "John Straumann" <[email protected]> wrote in messagenews:[email protected]...>>> Sys.Webforms.PageRequestManagerParserErrorException: The message receivedfrom the server could not be parsed. Common causes for this error are whenthe response is modified by calls to Response.Write(), response filters,HttpModules, or server trace is enabled. Details: Error parsing near'ue,true,true,true]}|<script language='ja">>>> I have no idea what that means!>>>> Could this eror be caused by the multiple-postbacks from the login andthen the population and selections from the drop-downs?>>>> Can anyone make a suggestion as to how to fix this, or a better idea thantwo drop-downs?>> It will be almost impossible for anyone to help you unless you post thecode which throws the above exception...>> However, at first glance, it looks like you're trying to write outJavaScript using Response.Write(). If so, then that's easily fixed...>>> --> Mark Rae> ASP.NET MVP> http://www.markrae.net
 
G

gareth erskine-jones

Hi Mark:

Thanks for your reply, again! :)

The code is a bit long and includes lots of calls to the CRM web services,
but I have pasted relevant parts below. I am not calling an JScript at all,
so I am not sure where that error is coming from.

The formatting of the code you posted went a bit wild at the end, and
I couldn't read it properly...

The error you posted is raised by the ASP.NET Ajax library. I suspect
that your drop down list boxes are in an update panel, but that
somewhere in your page you're injecting javascript (either directly,
or by using a control which is injecting javascript). The
ScriptManager object (which you must have on your page somewhere) has
a number of methods which can be used to inject javascript into the
page in a way that is compatible with the update panel.

GSEJ
 
J

John Straumann

Hi:

Yes you're right. The drop-downs are actually on a TabPanel inside a
TabContainer, which is in an Update panel...

Any suggestions to attack this?

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top