|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multiple Drop-DownsI 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.
Show quote
Hide quote
"John Straumann" <jstraum***@hotmail.com> wrote in message It will be almost impossible for anyone to help you unless you post the code news:8DCE64B7-12AB-474D-AF2F-829226DC4FF5@microsoft.com... > 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 > two drop-downs? which throws the above exception... However, at first glance, it looks like you're trying to write out JavaScript using Response.Write(). If so, then that's easily fixed... 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[i]; 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) { } } Show quoteHide quote //========================================================================================//========================================================================================//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[i]; 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]" <mark@markNOSPAMrae.net> wrote in messagenews:#gB6O2A9JHA.1***@TK2MSFTNGP03.phx.gbl...> "John Straumann" <jstraum***@hotmail.com> wrote in messagenews:8DCE64B7-12AB-474D-AF2F-829226DC4***@microsoft.com...>>> 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 error 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 On Tue, 23 Jun 2009 11:00:37 -0400, "John Straumann"
<jstraum***@hotmail.com> wrote: >Hi Mark: The formatting of the code you posted went a bit wild at the end, and> >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. 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 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. Show quoteHide quote "gareth erskine-jones" <g***@uberdog.net> wrote in message news:dds145lk6tm6qt8dspmh6ev4qjuipmeugl@4ax.com... > On Tue, 23 Jun 2009 11:00:37 -0400, "John Straumann" > <jstraum***@hotmail.com> wrote: > >>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 I would start with a tool such as http://www.fiddler2.com/fiddler2/.
It alllows to see the content of each http request. In this case it should allow to have a full view of the unwanted content, allowing to find more easily where the unwanted content comes from... If you are looking for cascading dropdowns instead of using updatepanels I would recommend using those provided by the ASP.NET Ajax Control Toolkit : http://www.asp.net/ajax/ajaxcontroltoolkit/samples/CascadingDropDown/CascadingDropDown.aspx -- Patrice "John Straumann" <jstraum***@hotmail.com> a écrit dans le message de groupe de discussion : CBE5F3DA-7D3B-4DBD-B34B-3889E3E66***@microsoft.com...Show quoteHide quote > 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. > > "gareth erskine-jones" <g***@uberdog.net> wrote in message > news:dds145lk6tm6qt8dspmh6ev4qjuipmeugl@4ax.com... >> On Tue, 23 Jun 2009 11:00:37 -0400, "John Straumann" >> <jstraum***@hotmail.com> wrote: >> >>>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 >
Other interesting topics
ASP.NET System.OutOfMemoryException
Custom ContentPlaceHolder False Positives From String Comparison using string.Equals() GetFiles, Delete Request.ServerVariables and master page MSDN help for MVC Initial class name for Default page is _Default instead of Default Value cannot be null. Parameter name: type Does "Launching..." mean something different then using NavigateUrl?? AJAX and RegisterStartupScript |
|||||||||||||||||||||||