Cascading Comboboxes To Work - Getting Method Error 500
Jan 31, 2011
I am trying to get my cascading comboboxes to work, but am getting a [Method error 500]. Any ideas? I've searched online, the code should work....Thanks in advance for your help!
ADDSTORY.ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addstory.aspx.cs" Inherits="addstory" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<td class="style3">
<asp:DropDownList ID="selectproject" runat="server" Width="225"></asp:DropDownList>
<asp:CascadingDropDown ID="ccd1" runat="server"
ServicePath="~/dropdown.asmx?company=<%=co_id %>" ServiceMethod="GetProjects"
TargetControlID="selectproject" Category="Project"
PromptText="Select Project" />
</td>
</tr>
<tr>
<td class="style3"></td>
<td width = "150" class="style3">Iteration:</td>
<d class="style3">
<asp:DropDownList ID="selectiteration" runat="server" Width="225"></asp:DropDownList>
<asp:CascadingDropDown ID="ccd2" runat="server"
ServicePath="~/dropdown.asmx?company=<%=co_id %>" ServiceMethod="GetIterations"
TargetControlID="selectiteration" Category="Iteration"
PromptText="Select Iteration" />
</td>
</tr>
DROPDOWN.ASMX:
using System.Web.Script.Services;
using AjaxControlToolkit;
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data.SqlClient;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "[URL]/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService()]
public class dropdown : System.Web.Services.WebService
{
private string GetConnectionString()
{
return System.Configuration.ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
}
[WebMethod]
public CascadingDropDownNameValue[] GetProjects(string knownCategoryValues, string category)
{
string co_id = this.Context.Request.QueryString["company"].ToString();
SqlConnection conn = new SqlConnection(GetConnectionString());
sonn.Open();
SqlCommand comm = new SqlCommand("Select ProjectName, ProjectID FROM Project WHERE CompanyID = '" + co_id + "'", conn);
SqlDataReader dr = comm.ExecuteReader();
List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
while (dr.Read())
{
l.Add(new CascadingDropDownNameValue(dr["ProjectName"].ToString(), dr["ProjectID"].ToString()));
}
conn.Close();
return l.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetIterations(string knownCategoryValues, string category)
{
int ProjectID;
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
if (!kv.ContainsKey("Project") || !Int32.TryParse(kv["Project"], out ProjectID))
{
throw new ArgumentException("Couldn't find project.");
};
SqlConnection conn = new SqlConnection(GetConnectionString());
conn.Open();
SqlCommand comm = new SqlCommand("SELECT Select CONVERT(VARCHAR(10), StartDate, 103) + ' - ' + CONVERT(VARCHAR(10), EndDate, 103) AS Iteration, ProjectIterationID FROM Iterations WHERE ProjectID=@ProjectID", conn);
comm.Parameters.AddWithValue("@ProjectID", ProjectID);
SqlDataReader dr = comm.ExecuteReader();
List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
while (dr.Read())
{
l.Add(new CascadingDropDownNameValue(dr["Iteration"].ToString(), dr["ProjectIterationID"].ToString()));
}
conn.Close();
return l.ToArray();
}
}
View 1 Replies
Similar Messages:
Dec 6, 2010
I have a cascading dropdown which loads countries into a dropdownlist.
When I type: www.domain.com, it all works.
However, when I type: domain.com it stops working and the dropdown shows: "[method error -1]"
Here's my code:
<asp:TextBox ID="tbCity" Width="90" MaxLength="50" CssClass="inactive" autocomplete="off" runat="server" />
<cc1:AutoCompleteExtender ID="AutoSuggestCities" runat="server" TargetControlID="tbCity"
CompletionInterval="2" CompletionSetCount="50" MinimumPrefixLength="3" ContextKey="" ServicePath="http://www.domain.com/geolocation.asmx" ServiceMethod="GetCitiesForCountryOrProvince" />
ps. I use url rewriting and to make sure the servicepath is always correct I used the full path.
View 7 Replies
Jan 22, 2011
i hv been tryin since a long time..but not able to resolve my problem.M making a cascadin dropdown with ajax but gettin method error 500 in my dropdown on running it..here's my code1. dataservice.cs file
using System;
using System.Web;
using System.Collections;
[code]...
View 1 Replies
Jul 27, 2010
I have created a dropdown through code behind.Then created a Cascading dropdown that also through code behind.
All the properties of cascading dropdown have been initialized properly (as i think).
And web service method is defined in separate file.
DDL and Cascading DDL have been created in App_code/NewFolder through a class file. That webservice.vb file too is placed in this folder. and webservide.asmx file is placed in root directory of the project.
When i run the project dropdown is filled only with [Method error 500]. query to fetch data from database have been written in webservice.vb file without any known error.
View 3 Replies
Sep 24, 2013
I would like to populate Cascading DropDownList From SQL Server.
I prepare my project the same way as in this article: [URL] ....
But all the time I have "Method error 500" I read many articles how to solve this issue but without success.
Below there are my codes:
----SQL DB has two tables:
1.tblUAP (UAP (PK), Start_Date,End_Date)
2.tblGAP(idGAP (PK),GAP,UAP(FK to tblUAP))
 ---project1.aspx
<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="Project1.aspx.cs" Inherits="TEST.Project1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
....
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
[Code].....
----Services.asmx
using System;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
[Code] ....
What else Can I check ??
View 1 Replies
Apr 16, 2010
I am getting [MethodError 500] when I use cascading drop down. below is my code
<tr>
<td >
Select a Hoster:
</td>
<td>
<asp:DropDownList ID="ddlFeaturedHoster" runat="server" ></asp:DropDownList>
</td>
</tr>
<ajaxToolkit:CascadingDropDown ID="cddHoster" runat="server" TargetControlID="ddlFeaturedHoster"
PromptText="Select a Hoster" LoadingText="Loading ..." Category="ActiveHoster"
ServiceMethod="GetDropDownContents" ServicePath="~/Hosting/HostingService.asmx"/>
Service Code:
[WebMethod]
[ScriptMethod]
public CascadingDropDownNameValue[] GetActiveHosters()
{
List<CascadingDropDownNameValue> returnList = new List<CascadingDropDownNameValue>();
HostersManager hosterManager = new HostersManager();
List<Hosters_HostingProviderDetail> hosters = hosterManager.GetAllHosters();
returnList.Add(new CascadingDropDownNameValue("--Please Select One--","0",true));
foreach (Hosters_HostingProviderDetail item in hosters)
{
returnList.Add(new CascadingDropDownNameValue() { name=item.HostingProviderName, value= item.HosterID.ToString()});
}
return returnList.ToArray() ;
}
[WebMethod]
[ScriptMethod]
public CascadingDropDownNameValue[] GetDropDownContents(string knownCategoryValues, string category)
{
knownCategoryValues = FormatCategoryWord(knownCategoryValues);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
HostersManager hosterManager = new HostersManager();
switch (category)
{
case "ActiveHoster":
values.AddRange(GetActiveHosters());
break;
case "ActiveOffer":
values.AddRange(GetActiveOffers(1));
break;
}
return values.ToArray<CascadingDropDownNameValue>();
}
/// <summary>
/// Formats the category word
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
private string FormatCategoryWord(string value)
{
if (string.IsNullOrEmpty(value)) return value;
if (value.LastIndexOf(":") > 0) value = value.Substring(value.LastIndexOf(":") + 1);
if (value.LastIndexOf(";") > 0) value = value.Substring(0, value.LastIndexOf(";"));
return value;
}
}
View 2 Replies
Oct 21, 2010
i'm using the Ajax cascading dropdown list it works fine. But how to call the server side after the dropdown list populated....
i don't want to call those method in drop down list index changed because it may cause postback..
View 6 Replies
Jan 25, 2011
i followed this tut http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=554 for cascading drop downs, but i changed the sql connections for my linq datasource. VS2010 is showing no errors in my code and the page loads fine too, but the two drop down lists are emptycan anyone scan there eyes over it and see if theres any reason why it shouldnt be working?my code is the same as the tuts apart from it uses LINQ instead of SQL
[Code]....
View 3 Replies
Apr 13, 2010
I am creating an Asp.net web site which will support dynamic data. When I am creating a dynamic web site from Scratch (from template in VS) all is working fine. But when I am trying to add dynamic entity (.edmx) file and running the application I am getting following error
"The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. "
View 2 Replies
Feb 12, 2010
I've been trying to replace my dropdownlists with ajax ComboBoxes so i can apply css in ie.
I can't seem to apply any css to the items in the dropdownlist. Here is my css:[Code]....
I've tried putting font styles in every class but it does nothing. The font in the actual text bar is styled correctly.
Also i've noticed the dropdownlist doesn't display all the items in it. Only the top 2.
View 1 Replies
Apr 6, 2010
I've just downloaded the latest Ajax libraries. I have a web site with dozens of ComboBoxes that worked fine until intalling the new libraries. Now the combobox dropdown lists, show behind the other ComboBoxes on the page.There was also an issue where the dropdown lists didn't display in the proper position, the div they are contained in is set to Position:Relative, I had to add position:absolute ! important along with coordinates of coarse to the css .WindowsStyle ul
View 1 Replies
Mar 21, 2011
I'm using an EditItemTemplate within a datalist, and I'd like to populate all comboboxes with the data that has already been entered whenever it goes into edit mode. I'm simply using this code:
Protected
Sub
DataList1_EditCommand(ByVal
[code]...
View 1 Replies
Dec 15, 2010
I don't know what I'm making wrong.I have a submit button, and on click it should execute the funktion in the code behind, but I get the error that the funktion is undefined.this is my code in the .aspx webform:
<%@ Page Language="C#" AutoEventWireup="True" MasterPageFile="~/DashMaster.master" CodeBehind="BI_MDR.aspx.cs" Inherits ="BI_MDR.StoredProc"%> [code].......
View 2 Replies
Nov 9, 2010
I have seen 2 methods to handle error in project. One is using try catch in every method and another is using custom page and error log file .I know both method. Which one is the best method?
View 9 Replies
Aug 6, 2010
I have a web app with several groups of cascading dropdownlists. All the cascading dropdownlists work as designed, but now the app is in the live enviroment with multiple users they are getting error 500 messages returned in some of the dropdownlists. Just wondered if there is a set amount of time to populate between selections? As these users are sometimes waiting tens of mins betwen selecting the values.On some of the dropdowns i'm pasing a date to the method using session variable whether this could be the issue? an example of one of the methods is below:
[Code]....
View 1 Replies
Jul 2, 2010
I have a problem with an asp.net project.I have a default.aspx page with a webusercontrol ascx inside.I have one combobox in my default.aspx and another combobox inside usercontrol.If I fire up my simple application, I noticed that when I select an item in one of the comboboxes, the selectionindexchaged event doesn't fire and le dropdown doesn't close.I have AutoPostBack="True" an all combo.
View 3 Replies
Mar 19, 2010
I have 3 cascading dropdown lists in an update panel. To submit the values of cascading dropdown without error it needs to turn eventvalidation off. Is there any way that i can avoid turning off the event validation and still use cascading dropdown?
View 1 Replies
Jan 22, 2011
I am getting the error Method 500 while filling 3092 cities in to cascading dropdown control. i am using the following code.
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="HotelDestination.asmx" />
</Services>
</asp:ScriptManager>
[code]...
View 2 Replies
Jan 22, 2010
I cannot get this method to work. I get a system. XmlException. The code below jsut shows how I am starting out. I want to create a simiple document and save it before I start working out how to add nodes etc. The file path will be my local machine - this project will all be on my local machine at the moment not even on a web page/server at all yet. Just a simple app to learn the basics of XML before I add to a web application I'm working on.
View 1 Replies
Aug 11, 2010
I'm trying to follow this article on cascading dropdown list in a GridView control in edit mode (except I'm using C#) [URL] I keep getting this error message "ProjectID is neither a DataColumn nor a DataRelation for table DefaultView."
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
{
DataRowView dv = (DataRowView)e.Row.DataItem;
//// Preselect correct value in Projects list
DropDownList listProjects = (DropDownList)e.Row.FindControl("DropDownList1");
listProjects.SelectedValue = dv["ProjectID"].ToString(); // *****************this is where I get the error *********
// Databind list of categories in dependent drop-down list
DropDownList listCategories = (DropDownList)e.Row.FindControl("DropDownList2");
SqlDataSource dsc = (SqlDataSource)e.Row.FindControl("sdsDDL2");
dsc.SelectParameters["ProjectName"].DefaultValue = dv["ProjectName"].ToString();
listCategories.DataBind();
listCategories.SelectedValue =(dv["CategoryID"].ToString());
}
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ttuser %>" SelectCommand="SELECT
TE.TimeEntryID,
P.ProjectName,
CAT.CategoryName,
TE.TimeEntryDescription,
TE.TimeEntryDuration,
TE.TimeEntryDate
FROM dbo.aspnet_starterkits_TimeEntry TE inner join
dbo.aspnet_starterkits_ProjectCategories CAT on
TE.CategoryID=CAT.CategoryID inner join
dbo.aspnet_starterkits_Projects P on
CAT.ProjectID=P.ProjectID
Where TimeEntryUserID=(SELECT UserId FROM dbo.aspnet_Users WHERE
UserName=@UserName) AND
TE.TimeEntryDate=@WeekEnding
" OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE dbo.aspnet_starterkits_TimeEntry
SET
TimeEntryDescription=@TimeEntryDescription,
TimeEntryDuration=@TimeEntryDuration,
TimeEntryDate=@TimeEntryDate
WHERE
TimeEntryID=@original_TimeEntryID">
<SelectParameters>
<asp:ControlParameter ControlID="UserList" Name="UserName"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="WeekEnding2" Name="WeekEnding"
PropertyName="Text" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="TimeEntryDescription" />
<asp:Parameter Name="TimeEntryDuration" />
<asp:Parameter Name="TimeEntryDate" />
<asp:Parameter Name="original_TimeEntryID" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" BorderWidth="0px"
BorderStyle="None" Width="100%" CellPadding="2" PageSize="25"
DataKeyNames="TimeEntryID" onrowdatabound="GridView1_RowDataBound"
onrowupdating="GridView1_RowUpdating" >
<Columns>
<%--<asp:CommandField ShowEditButton="True" />--%>
<asp:BoundField DataField="TimeEntryID" HeaderText="ID"
SortExpression="TimeEntryID" InsertVisible="False" ReadOnly="True"
ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Project" SortExpression="ProjectName">
<EditItemTemplate>
<asp:DropDownList
ID="DropDownList1"
runat="server"
DataSourceID="sdsDdlProjectsEdit"
DataTextField="ProjectName"
DataValueField="ProjectID"
AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource
ID="sdsDdlProjectsEdit"
runat="server"
ConnectionString="<%$ ConnectionStrings:ttuser %>"
SelectCommand="SELECT ProjectID,ProjectName FROM dbo.aspnet_starterkits_Projects">
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("ProjectName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryName">
<EditItemTemplate>
<asp:DropDownList
ID="DropDownList2"
runat="server"
DataSourceID="sdsDDL2"
DataTextField="CategoryName"
DataValueField="CategoryID">
</asp:DropDownList>
<asp:SqlDataSource
ID="sdsDDL2"
runat="server"
ConnectionString="<%$ ConnectionStrings:ttuser %>"
SelectCommand="SELECT CategoryID,CategoryName FROM dbo.aspnet_starterkits_ProjectCategories WHERE ProjectID=@ProjectID">
<SelectParameters>
<asp:Parameter Name="ProjectID" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField DataField="TimeEntryDescription" HeaderText="Description"
SortExpression="TimeEntryDescription" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="TimeEntryDuration" HeaderText="Hours"
SortExpression="TimeEntryDuration" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField ApplyFormatInEditMode="True" DataField="TimeEntryDate"
DataFormatString="{0:d}" HeaderText="Week Ending"
SortExpression="TimeEntryDate" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:CommandField ShowEditButton="True" HeaderText="Edit" ButtonType="Image" EditImageUrl="images/icon-edit.gif"
UpdateImageUrl="images/icon-save.gif" CancelImageUrl="images/icon-cancel.gif" />
</Columns>
</asp:GridView>
View 3 Replies
Sep 16, 2010
I've just discovered that the X-Requested-With header in IE is always "XMLHttpRequest, XMLHttpRequest" instead of just "XMLHttpRequest". I found the reason in MicrosoftMvcAjax.debug.js at line 280 (MVC 2.0). Seems there is no need to add this header again as it is already done in Microsoft AJAX Library. And because of this IsAjaxRequest extension method doesn't work anymore if there is no X-Requested-With param in the request body. And this make X-Requested-With header useless in IE.
In Firefox there is no problem as it doesn't append but replace the existing header value. Not tested in other browsers.
View 9 Replies
Aug 1, 2010
I am trying to use YAF with Umbraco. The newest version out changed enough where the old integration methods don't seem to work. I have gotten everything fairly far on my own but I have hit a brick wall with this error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Source Error:
Line 23: <img src="~/yaf/images/YAFLogo.jpg" runat="server" alt="YetAnotherForum" id="imgBanner" /><br/>
Line 24: <form id="form1" runat="server" enctype="multipart/form-data">
Line 25: <YAF:Forum runat="server" ID="yafForum" />
Line 26: </form>
Line 27: </body>
I have a feeling that YAF is not starting up the database. In previous versions of YAF there was an INIT module that you loaded in your web.config file. This module is no longer there (YAF.Base.YAFInitModule).
View 2 Replies
Feb 8, 2011
i have a masterpage and other pages. i want to use findcontrol method to find a textbox (not on the master page) to check whether it is empty or not.
my code is as folows;
Dim myContentPlaceHolder As ContentPlaceHolder = CType(Master.FindControl("MainContent"), ContentPlaceHolder)
Dim UpdatePanel1 As UpdatePanel = CType(myContentPlaceHolder.FindControl("UP1"), UpdatePanel)
View 3 Replies
Feb 20, 2010
I'm making a custom MembershipProvider and RoleProvider.
I have database tables with Roles and UsersInRoles and I use LINQ-to-SQL to create objects of the tables.
When invoking [Authorize] on an action method, will it work with my custom RoleProvider?
How does it know if the user is authenticated and if the user is in the appropriate role?
View 1 Replies
Nov 16, 2010
I'm unable to set Comments property of a MembershipUser type objects.
E.g.
MembershipUser mu = Membership.GetUser(username);
mu.Comment = "someComments";
I'd expect this to set the Comment property of mu object to "someComments" and write changes to the database.
Later, I do a following check:
mu.Comment == "someComments";
Comment property is set to null. Is there anythign that I need to change in a web.config or...?
View 2 Replies