Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
6/15/2010 1:36:59 PM
Gravatar
Total Posts 32

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Our custom module is on the Home page and when we launch the application and click on a regionmap in an update panel we retrieve properties from a database to display in a grid in a second update panel.

This generates this error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

When navigating to a different page and back to the home page and performing the same action no errors occur.

View source:

<td>
<span id="ctl01_mainContent_ctl00_Label12">Region:</span>
</td>
<td>
<select name="ctl01$mainContent$ctl00$ddRegion" id="ctl01_mainContent_ctl00_ddRegion" style="font-size:Small;font-weight:normal;font-style:normal;text-decoration:none;">
<option value="Any">Any</option>
<option value="Centre">Centre</option>
<option value="Provence-Alpes-Côte d&#39;Azur">Provence-Alpes-C&#244;te d&#39;Azur</option>
<option value="Nord-Pas de Calais">Nord-Pas de Calais</option>
<option value="Auvergne">Auvergne</option>
<option value="Île-de-France">&#206;le-de-France</option>
<option value="Aquitaine">Aquitaine</option>
<option value="Haute-Normandie">Haute-Normandie</option>
<option value="Corse">Corse</option>
<option value="Lorraine">Lorraine</option>
<option value="Bretagne">Bretagne</option>
<option value="Alsace">Alsace</option>
<option value="Midi-Pyrénées">Midi-Pyr&#233;n&#233;es</option>
<option value="Picardie">Picardie</option>
<option value="Basse-Normandie">Basse-Normandie</option>
<option value="Limousin">Limousin</option>
<option value="Rhône-Alpes">Rh&#244;ne-Alpes</option>
<option value="Poitou-Charentes">Poitou-Charentes</option>
<option value="Languedoc-Roussillon">Languedoc-Roussillon</option>
<option value="Pays-de-la-Loire">Pays-de-la-Loire</option>
<option value="Franche-Comté">Franche-Comt&#233;</option>
<option value="Bourgogne">Bourgogne</option>
<option value="Champagne-Ardenne">Champagne-Ardenne</option>

</select>
</td>
</tr>
<tr>


6/15/2010 2:05:40 PM
Gravatar
Total Posts 18439

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Hi,

Please in the future do not report problems with your own custom features in the bugs forum. This is not a bug in mojoPortal but an error happening in custom code. You can ask such questions in the developer forum but I can't guarantee to answer every question.

I do not know the cause of this error and I have no idea what the code is doing based on the posted markup. I think if the second updatepanel is not nested inside the first one then it can't update the second one, it can only update things inside itself.

I suggest that if you google the error you will find lots of results you can research. The information here may help you discover the actual error happening

http://msdn.microsoft.com/en-us/library/bb397479.aspx

Hope it helps,

Joe

6/17/2010 7:29:49 AM
Gravatar
Total Posts 32

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Joe

Further investigation learned when using a custom module with AJAX (like updatepanel) on the home page it always goes wrong because of registration in the scriptmanager.

custom module is ok because if navigation to another page and back to home it works.

if site is launched with www.domain.com/default.aspx it also work perfect.

So it is a bug and not related to custom module (in my opinion)

Bypass would be to setup IIS 7 in such a way that www.domain.com is server/redirected to www.domain.com/default.aspx

can this be done?

6/17/2010 7:52:06 AM
Gravatar
Total Posts 18439

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Sorry but I don't think so. I am able to do whatever I need in an updatepanel and I don't have these problems on any page.

Of course I have not seen your code but my best guess is that somewhere you are using PageMethods inside a UserControl, or you are using some third party control that needs a custom ScriptManager instead of the asp.net script manager, in which case you would have to replace the scriptmanager declaration in layout.master with a declaration for the third party one.

One other thing that may help is that there can be bugs in UpdatePanel itself where it loses the form action after a the first update, in my code where I use UpdatePanels you will see my solution like this

try
            {
                // this keeps the action from changing during ajax postback in folder based sites
                SiteUtils.SetFormAction(Page, Request.RawUrl);
            }
            catch (MissingMethodException)
            {
                //this method was introduced in .NET 3.5 SP1
            }

which will be called from pageload in any contro where I'm using an UpdatePanel

The try catch is because it is a new method since .NET 3.5 SP1, so an error is thrown if not using SP1 of 3.5 or else 4.0 .NET

Hope it helps,

Joe

6/17/2010 9:10:54 AM
Gravatar
Total Posts 32

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Joe

tried this no success. Although you must be right, you are the expert and I'm new to c#.

Hereby the ascx code and the code behind.Can you s

Can you see what stupid mistake i'm making?

ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GPISearch.ascx.cs" Inherits="GPImmo.UI.GPISearch" %>
<link href="GPI.css" rel="stylesheet" type="text/css" />

<style type="text/css">
.style1
{
width: 309px;
}
</style>

<portal:mojoPanel ID="mp1" runat="server" ArtisteerCssClass="art-Post" RenderArtisteerBlockContentDivs="true">

<mp:CornerRounderTop id="ctop1" runat="server" />
<asp:Panel ID="pnlWrapper" runat="server" cssclass="art-Post-inner panelwrapper GPImmo">

<portal:mojoPanel ID="MojoPanel1" runat="server" ArtisteerCssClass="art-PostContent">
<asp:Panel ID="pnlGPImmo" runat="server" CssClass="modulecontent">
 


<div class="clear">
<asp:UpdatePanel runat="server" ID="Updatepanel1" UpdateMode="Always">
<ContentTemplate>

<table width="100%">
<tr>
<td valign="top" class="style1">
<asp:ImageMap ID="ImageMap1" runat="server" BorderWidth="0px"
ImageUrl="~/Images/france_map_large.gif" onclick="ImageMap1_Click"
HotSpotMode="PostBack" EnableViewState="False">
<asp:PolygonHotSpot Coordinates="271,75,263,85,259,103,258,119,252,119,247,107,255,80,251,76,259,75,260,72" AlternateText="Alsace" PostBackValue="Alsace" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="112,172,93,190,75,174,64,227,54,240,62,242,61,247,81,258,91,245,86,234,89,223,111,220,127,195,123,188,123,181,118,174" AlternateText="Aquitaine" PostBackValue="Aquitaine" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="166,141,158,142,157,148,149,148,149,151,156,158,155,166,152,169,154,180,143,195,144,204,149,204,155,195,161,201,169,196,181,202,192,191,188,185,181,187,179,183,182,180,176,172,178,157,184,152,177,143,169,145" AlternateText="Auvergne" PostBackValue="Auvergne" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="83,46,72,44,72,51,77,61,75,78,92,83,103,79,106,85,112,83,119,92,123,85,113,69,112,57,104,61,88,56,85,57,81,50" AlternateText="Basse Normandie" PostBackValue="Basse Normandie" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="174,92,184,106,201,104,214,119,215,130,211,136,214,140,213,151,204,148,201,156,184,156,186,152,178,140,173,142,167,139,167,124,165,123,165,110,170,103,168,97,168,92" AlternateText="Bourgogne" PostBackValue="Bourgogne" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="82,82,80,100,59,104,53,109,39,104,21,91,11,87,13,83,14,80,9,74,16,70,34,71,36,68,43,67,50,79,57,76" AlternateText="Bretagne" PostBackValue="Bretagne" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="123,79,136,76,145,93,154,93,156,98,166,98,168,103,163,111,163,124,165,127,166,139,155,141,155,146,126,149,116,129,110,130,104,124,108,113,119,109,124,97,123,91,127,86" AlternateText="Centre" PostBackValue="Centre" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="195,44,203,42,210,52,204,79,219,98,221,110,213,115,201,101,186,103,176,90,179,76" AlternateText="Champagne-Ardenne" PostBackValue="Champagne-Ardenne" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="275,236,272,246,268,246,258,254,264,280,272,284,276,277,275,267,279,263" AlternateText="Corse" PostBackValue="Corse" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="218,115,228,106,240,108,247,113,250,122,223,156,214,154,217,144,216,138,213,135,217,130" AlternateText="Franche-Comté" PostBackValue="Franche-Comté" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="137,39,140,43,139,50,140,62,134,68,135,73,122,76,120,70,116,70,115,53,110,53,116,46,124,44,132,43" AlternateText="Haute-Normandie" PostBackValue="Haute-Normandie" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="139,67,146,66,168,71,174,77,175,84,173,90,166,91,165,96,157,96,155,90,147,90,138,75" AlternateText="Île-de-France" PostBackValue="Île-de-France" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="169,198,162,204,165,219,171,227,160,238,152,239,153,244,134,245,131,250,137,256,135,264,140,266,130,271,136,276,142,273,149,277,160,273,160,254,183,241,188,243,200,228,194,219,183,219,178,203" AlternateText="Languedoc-Roussillon" PostBackValue="Languedoc-Roussillon" HotSpotMode="PostBack" />

<asp:PolygonHotSpot Coordinates="119,155,126,151,146,150,153,159,153,165,149,169,151,180,140,195,135,195,133,192,129,192,126,185,127,181,120,172,115,172,114,170,119,164" AlternateText="Limousin" PostBackValue="Limousin" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="212,55,235,60,241,70,257,69,258,74,246,73,244,76,252,82,244,108,232,102,223,104,223,95,208,80" AlternateText="Lorraine" PostBackValue="Lorraine" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="130,194,114,221,90,225,88,234,94,245,84,257,90,262,104,263,106,259,131,268,135,266,132,264,134,256,129,251,132,243,151,243,149,237,160,235,168,227,162,219,157,200,150,207,142,207,140,197,134,198" AlternateText="Midi-Pyrénées" PostBackValue="Midi-Pyrénées" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="161,8,144,12,143,28,166,37,191,39,190,32" AlternateText="Nord-Pas de Calais" PostBackValue="Nord-Pas de Calaiss" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="84,84,97,85,103,83,117,95,119,100,114,107,105,110,100,124,89,124,82,127,86,143,85,148,79,145,74,147,64,142,58,130,61,125,51,114,61,107,68,107,81,101" AlternateText="Pays de la Loiree" PostBackValue="Pays de la Loire" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="144,31,139,37,145,46,144,63,172,67,176,75,180,61,187,57,188,51,191,48,191,42,166,40" AlternateText="Picardie" PostBackValue="Picardie" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="90,126,84,129,89,147,86,150,78,148,73,153,73,166,91,186,95,186,117,163,116,153,124,149,114,132,109,132,102,126" AlternateText="Poitou-Charentes" PostBackValue="Poitou-Charentes" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="198,221,203,228,190,244,211,248,223,256,240,253,259,234,262,225,252,226,244,217,248,205,239,195,233,196,235,203,226,203,216,216,221,221,216,226,205,221" AlternateText="Provence-Alpes-Côte d'Azur" PostBackValue="Provence-Alpes-Côte d'Azur" HotSpotMode="PostBack" />
<asp:PolygonHotSpot Coordinates="240,154,229,163,227,155,222,158,206,151,202,160,181,159,180,172,185,179,184,184,190,183,195,191,182,205,186,217,208,219,215,224,218,221,213,217,217,208,227,201,233,200,230,193,248,191,250,185,242,174,247,168" AlternateText="Rhône-Alpes" PostBackValue="Rhône-Alpes" HotSpotMode="PostBack" />
</asp:ImageMap>
</td>
<td valign="top">
<table width="100%" style="width: 100%">

<tr>
<td colspan="2">
<h2>
<asp:Label ID="lblcounter" runat="server"></asp:Label>
</h2>
</td>
</tr> <tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Region:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddRegion" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Locality:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddLocality" runat="server">
<asp:ListItem Selected="True" Value="0">Town</asp:ListItem>
<asp:ListItem Value="1">Rural</asp:ListItem>
<asp:ListItem Value="2">Village</asp:ListItem>
<asp:ListItem Value="3">Hamlet</asp:ListItem>
<asp:ListItem Value="4">Coastal</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Property type:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddPropertyType" runat="server">
<asp:ListItem>house</asp:ListItem>
<asp:ListItem>villa</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Price range:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddPriceFrom" runat="server">
<asp:ListItem Value="Up to 100.000">Up to 100.000</asp:ListItem>
<asp:ListItem>100.000 - 150.000</asp:ListItem>
<asp:ListItem>150.000 - 200.000</asp:ListItem>
<asp:ListItem>200.000 - 250.000</asp:ListItem>
<asp:ListItem>250.000 - 300.000</asp:ListItem>
<asp:ListItem>300.000 - 400.000</asp:ListItem>
<asp:ListItem Selected="True">400.000 - 500.000</asp:ListItem>
<asp:ListItem>500.000 - 700.000</asp:ListItem>
<asp:ListItem>700.000 - 1.000.000</asp:ListItem>
<asp:ListItem>Above 1.000.000</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Min. bedrooms:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddMinBed" runat="server">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
</asp:DropDownList>
</td>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="Min. bathrooms:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddMinBath" runat="server">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label9" runat="server" Text="Min. livingspace:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddMinHabitable" runat="server">
<asp:ListItem Selected="True">0</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>150</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label11" runat="server" Text="Min. landsize:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddMinLand" runat="server">
<asp:ListItem Selected="True">0</asp:ListItem>
<asp:ListItem>1000</asp:ListItem>
<asp:ListItem>2000</asp:ListItem>
<asp:ListItem>4000</asp:ListItem>
<asp:ListItem>5000</asp:ListItem>
<asp:ListItem>10000</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" CssClass="buttonlink"
onclick="Button1_Click" Text="Search" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblsql" runat="server" Text=""></asp:Label>
</td>
</tr>

</tr>

</table>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel runat="server" id="gridpanel" UpdateMode="Conditional">
<ContentTemplate>
<div class="cleared">
Search results:
<br />
<mp:mojoGridView ID="mojoGridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" OnPageIndexChanging="gridView_PageIndexChanging"
onselectedindexchanged="mojoGridView1_SelectedIndexChanged"
Width="100%">
<Columns>
<asp:TemplateField>
<ItemTemplate>

<div class="property">
<div class="img">
<asp:label runat="server" Text='<%# ShowMainPhoto(Convert.ToInt32(Eval("ReferenceNumber"))) %>' ID="Labelmainphoto" />
</div>
<div class="details">

<div class="description">
<asp:Label ID="lbldesc" runat="server" Text='<%# ShowDescription(Convert.ToString(Eval("ShortDescription"))) %>'></asp:Label>
</div>
<div class="title">

<asp:Label ID="lblreference" runat="server" Text='<%# Bind("ReferenceNumber") %>'></asp:Label>
</div>
<br />
<div class="price">
<asp:Label runat="server" ID="lblprice" Text='<%# String.Format("{0:€ #,#}", (DataBinder.Eval(Container.DataItem, "SalesPrice"))) %>'></asp:Label>
</div>
<div class="readmore">
</div>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>



</Columns>
<PagerSettings Position="TopAndBottom" />
</mp:mojoGridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Panel>
</portal:mojoPanel>
</asp:Panel>
<mp:CornerRounderBottom id="cbottom1" runat="server" />
</portal:mojoPanel>


and the code behind

 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using mojoPortal.Web;
using mojoPortal.Web.Framework;
using mojoPortal.Web.UI;
using log4net;
using GPImmo.Business;
using Resources;
using System.Data.Sql;
using System.Data.SqlClient;
namespace GPImmo.UI
{
public partial class GPISearch : SiteModuleControl
{
#region OnInit

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Load += new EventHandler(Page_Load);

}

#endregion

protected void Page_Load(object sender, EventArgs e)
{
try
{
SiteUtils.SetFormAction(Page, Request.RawUrl);
PopulateControls();
}
catch (MissingMethodException)
{ }

// LoadData();
}
 

private static string GetConnectionString()
{
return ConfigurationManager.AppSettings["GPImmoConnectionString"];

}
private void PopulateControls()
{

if (this.ModuleConfiguration != null)
{
this.Title = this.ModuleConfiguration.ModuleTitle;
this.Description = this.ModuleConfiguration.FeatureName;
}

SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
SqlCommand sqlcommand = new SqlCommand("select Name from propertytype");
sqlcommand.Connection = conn;
SqlDataReader dr = sqlcommand.ExecuteReader();
//SqlDataAdapter sqldataadapter = new SqlDataAdapter(sqlcommand);

ddPropertyType.Items.Clear();
ListItem li = new ListItem();
li.Text = "Any";
li.Value = "Any";
ddPropertyType.Items.Add(li);
while (dr.Read())
{
ListItem listitem = new ListItem();
listitem.Text = (string) dr["Name"];
listitem.Value = (string)dr["Name"];
ddPropertyType.Items.Add(listitem);
}
dr.Close();

//'ddRegion
sqlcommand.CommandText = "Select Name From Region";
SqlDataReader drregion = sqlcommand.ExecuteReader();
ddRegion.Items.Clear();
ListItem li2 = new ListItem();
li2.Text = "Any";
li2.Value = "Any";
ddRegion.Items.Add(li2);
while (drregion.Read())
{ ListItem listitem = new ListItem();
listitem.Text = (string)drregion["Name"];
listitem.Value = (string)drregion["Name"];
ddRegion.Items.Add(listitem);
}
drregion.Close();

sqlcommand.CommandText = "Select count(*) from propertyobject where publishonwebsite = 1 ";

Int32 counter = (Int32)sqlcommand.ExecuteScalar();
lblcounter.Text = "Properties online : " + counter.ToString();

//lblcounter
conn.Close();

}
 

protected void Button1_Click(object sender, EventArgs e)
{
LoadData();
}

protected void ImageMap1_Click(object sender, ImageMapEventArgs e)
{
ddRegion.SelectedValue = e.PostBackValue.ToString();
LoadData();
}

private void LoadData()
{


SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
String szSQL = String.Empty ;
// first filter is property type
szSQL = "Select * from vwproperties Where ";
switch (ddPriceFrom.SelectedItem.ToString())
{
case "Up to 100.000": szSQL += " SalesPrice < 100000 "; break;
case "100.000 - 150.000": szSQL += " SalesPrice Between 100000 and 150000 "; break;
case "150.000 - 200.000": szSQL += " SalesPrice Between 150000 and 200000 "; break;
case "200.000 - 250.000": szSQL += " SalesPrice Between 200000 and 250000 "; break;
case "250.000 - 300.000": szSQL += " SalesPrice Between 250000 and 300000 "; break;
case "300.000 - 400.000": szSQL += " SalesPrice Between 300000 and 400000 "; break;
case "400.000 - 500.000": szSQL += " SalesPrice Between 400000 and 500000 "; break;
case "500.000 - 700.000": szSQL += " SalesPrice Between 500000 and 700000 "; break;
case "700.000 - 1.000.000": szSQL += " SalesPrice Between 700000 and 100000 "; break;
case "Above 1.000.000": szSQL += " SalesPrice > 1000000 "; break;
default: break;
}
string region = Convert.ToString(ddRegion.SelectedValue);
int nminbed = Convert.ToInt32(ddMinBed.SelectedValue);
int nminbath = Convert.ToInt32(ddMinBath.SelectedValue);
int nminliving = Convert.ToInt32(ddMinHabitable.SelectedValue);
int nminland = Convert.ToInt32(ddMinLand.SelectedValue);
int nloc = Convert.ToInt32(ddLocality.SelectedValue);
szSQL += " AND NumberOfBedRooms > " + nminbed + " ";
szSQL += " AND NumberOfBathRooms > " + nminbath + " ";
szSQL += " AND HabitableSurface > " + nminliving + " ";
szSQL += " AND TotaleSurface > " + nminland + " ";
// to avoid any
if (nloc>-1)
szSQL += " AND Locality = " + nloc;
if (region.Contains("'"))
region = region.Replace("'", "%");
if (region != "Any")
szSQL+= " AND Region like '" + region + "' " ;

string proptype = Convert.ToString(ddPropertyType.SelectedValue);
if (proptype != "Any")
szSQL += " AND PropertyType = '" + proptype + "'";
SqlCommand sqlcommand = new SqlCommand(szSQL );
sqlcommand.Connection = conn;
SqlDataAdapter sqldataadapter = new SqlDataAdapter(sqlcommand);
DataSet ds = new DataSet();
sqldataadapter.Fill(ds);
mojoGridView1.DataSource = ds.Tables[0];
lblsql.Text = "Found: " + ds.Tables[0].Rows.Count.ToString() + "properties";
mojoGridView1.DataBind();
conn.Close();
gridpanel.Update();
}
protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
mojoGridView1.PageIndex = e.NewPageIndex;

LoadData();

}

protected void mojoGridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}

#region gridfunctions
protected string ShowDescription(string desc)
{
string ret = String.Empty;
if (desc.Length > 50)
ret = desc.Substring(0, 50);
else
ret = desc;

return ret;
}
protected string ShowMainPhoto(Int32 refnr)
{
SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
SqlCommand sqlcommand = new SqlCommand("select * from VWMAINIMAGE Where ReferenceNumber = " + refnr );
sqlcommand.Connection = conn;
string szFileLink = "";
SqlDataReader dr = sqlcommand.ExecuteReader();
if (dr.HasRows == true)
while (dr.Read())
{
szFileLink = "http://backoffice.gp-immo.com//ObjectImages//";
DateTime created = (DateTime)dr["CreationDate"];
string filename = (string)dr["ImageName"];

DateTime dt = new DateTime(2008,9,16);
if ((DateTime)dr["CreationDate"]> new System.DateTime(2008, 9, 16))
{
szFileLink += refnr.ToString() + "//";
}
szFileLink += filename;
}
dr.Close();
conn.Close();
// string szurl = "this is the result of the function";
string szurl = "<a class=\"foto\" target=\"_self\" href=\"propertyDetail.aspx?property=" + refnr + "\"> <img src=\"" + szFileLink + "\" width=\"180px\"></a>";

return szurl;
}
#endregion


 

}
}

 

6/17/2010 11:03:27 AM
Gravatar
Total Posts 18439

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Hi,

One problem is that your page load event fires twice because you have AutoEventWireup="true" and you have

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Load += new EventHandler(Page_Load);

}

so the event is wired twice and will fire twice.

It isn't really clear to me why you are using 2 UpdatePanels, I would use just one with UpdateMode="Conditional"

I think the call from PageLoad to PopulateControls should not be in the try catch and probably should be wrapped in

if(!Page.IsPostback)

because if you are using viewstate it should not need to rebind those dropdowns on postback

also you should not have any of this in a UserControl:

<link href="GPI.css" rel="stylesheet" type="text/css" />

<style type="text/css">
.style1
{
width: 309px;
}
</style>

it is invalid html to have that outside of head and it won't correctly resolve the url for GPI.css

Also if any error happens in your code the connection remains open, assuming you are using the same connection string as mojoPortal, you can simplify and improve this code:

SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
SqlCommand sqlcommand = new SqlCommand("select Name from propertytype");
sqlcommand.Connection = conn;
SqlDataReader dr = sqlcommand.ExecuteReader();
//SqlDataAdapter sqldataadapter = new SqlDataAdapter(sqlcommand);

ddPropertyType.Items.Clear();
ListItem li = new ListItem();
li.Text = "Any";
li.Value = "Any";
ddPropertyType.Items.Add(li);
while (dr.Read())
{
ListItem listitem = new ListItem();
listitem.Text = (string) dr["Name"];
listitem.Value = (string)dr["Name"];
ddPropertyType.Items.Add(listitem);
}
dr.Close();

by changing it like this:

ddPropertyType.Items.Clear();
ListItem li = new ListItem();
li.Text = "Any";
li.Value = "Any";
ddPropertyType.Items.Add(li);
using (IDataReader dr = mojoPortal.Business.DatabaseHelper.GetReader("select Name from propertytype"))
{
while (dr.Read())
{
ListItem listitem = new ListItem();
listitem.Text = (string) dr["Name"];
listitem.Value = (string)dr["Name"];
ddPropertyType.Items.Add(listitem);
}
}

this will close the connection even if an error happens

I realize only some of this feedback pertains to your issue about the error, but the suggestions at the beginning may help with that.

Also setting break points and stepping through the code may reveal where the problem is happening.

Best,

Joe

6/17/2010 11:20:05 AM
Gravatar
Total Posts 32

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Joe

thanks for your time and help this is crucial.

will solve everything tonight.

peter

6/17/2010 2:14:45 PM
Gravatar
Total Posts 18439

Re: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

Hi Peter,

Thought of one other thing that may help.

Are you experiencing this error in IIS or just using the VS Web Server? I've seen some cases where postback to / instead of say /Default.aspx can throw an error in the VS Web Server that does not happen in IIS

possibly it can be solved by changing my previous advice from this:

try
{
       // this keeps the action from changing during ajax postback in folder based sites
         SiteUtils.SetFormAction(Page, Request.RawUrl);
  }
 catch (MissingMethodException)
  {
        //this method was introduced in .NET 3.5 SP1
 }

change it to this and see if it makes a difference:

try
{
       // this keeps the action from changing during ajax postback in folder based sites
         SiteUtils.SetFormAction(Page, SiteUtils.GetCurrentPageUrl());
  }
 catch (MissingMethodException)
  {
        //this method was introduced in .NET 3.5 SP1
 }

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.