ADO.NET :: Couldn't Find Non Generic Method 'DeleteProduct'
Sep 24, 2010
Code:
<asp:GridView ID="ProductsGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="ID,UserId"
DataSourceID="ProductsOptimisticConcurrencyDataSource"
OnRowUpdated="ProductsGrid_RowUpdated" AllowPaging="True" AllowSorting="True"
EnableModelValidation="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" ValidationGroup="InsertValidationControls" />
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID"
ReadOnly="True" InsertVisible="False" />
<asp:BoundField DataField="UserId" HeaderText="UserId" ReadOnly="True"
SortExpression="UserId" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ProductsOptimisticConcurrencyDataSource" runat="server"
ConflictDetection="CompareAllValues"
SelectMethod="GetZaposleniBy" TypeName="zaposleni"
OnDeleted="ProductsOptimisticConcurrencyDataSource_Deleted"
OnUpdated="ProductsOptimisticConcurrencyDataSource_Updated"
onselecting="ProductsOptimisticConcurrencyDataSource_Selecting"
DeleteMethod="DeleteProduct">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]
public bool DeleteProduct(int ID)
{
Guid UserId = Guid.NewGuid();
int rowsAffected = Adapter.Delete(ID,UserId);
// Return true if precisely one row was deleted, otherwise false
return rowsAffected == 1;
}
The problem is when I use Guid UserId = Guid.NewGuid ();.
In Table I UserId type: unique Therefore it does not work. If I use the UserId type: int working.
Error:
ObjectDataSource 'ProductsOptimisticConcurrencyDataSource' could not find a non-generic method 'DeleteProduct' that has parameters: ID, UserId.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ObjectDataSource 'ProductsOptimisticConcurrencyDataSource' could not find a non-generic method 'DeleteProduct' that has parameters: ID, UserId.
Source Error:
[Code]....
Stack Trace:
[Code]....
[InvalidOperationException: ObjectDataSource 'ProductsOptimisticConcurrencyDataSource' could not find a non-generic method 'DeleteProduct' that has parameters: ID, UserId.]
System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation) +1119426
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +504
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +89
System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +714
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +869
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565a
View 2 Replies
Similar Messages:
Dec 20, 2010
I have this ASP.NET code:
<asp:DropDownList
ID="ddlBrokers"
runat="server"
AutoPostBack="true"
DataSourceID="srcBrokers"
DataTextField="broker"
DataValueField="brokerId"
/>
<asp:ObjectDataSource
id="srcBrokers"
TypeName="DatabaseComponent.DBUtil"
SelectMethod="GetBrokers"
runat="server">
</asp:ObjectDataSource>
My DAL code:
public DataTable GetBrokers(bool? hasImport=null)
{
SqlCommand cmd = new SqlCommand("usp_GetBrokers");
if (hasImport.HasValue)
cmd.Parameters.AddWithValue("@hasImport", hasImport);
return FillDataTable(cmd, "brokers");
}
When the form loads I get this error:
ObjectDataSource 'srcBrokers' could not find a non-generic method 'GetBrokers' that has no parameters.
Is it my optional parameter that is causing the problem? How can I workaround this? Is it possible to have optional parameters with declarative ASP.NET code?
View 1 Replies
Mar 7, 2011
I am binding dropdown list using Object data source. I got an error like this
"ObjectDataSource 'objDSStatus' could not find a non-generic method 'GetIssueAllowedStatusByCategoryIDStatusIDandUserType' that has parameters: IssueCategoryID."
My code is as follows .aspx
< asp:DropDownList ID="ddlStatus" runat="server" DataSourceID="objDSStatus"
DataTextField="IssueStatusName" DataValueField="IssueStatusID">
< /asp:DropDownList>
< asp:ObjectDataSource ID="objDSStatus" runat="server" TypeName="DA"></asp:ObjectDataSource>
.cs
private void Bind(int IssueCategoryID, int IssueStatusID, int UserType)
{
ddlStatus.Items.Clear();
objDSStatus.SelectMethod = "GetIssueAllowedStatusByCategoryIDStatusIDandUserType";
objDSStatus.SelectParameters.Clear();
objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString());
objDSStatus.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString());
objDSStatus.SelectParameters.Add("UserType", UserType.ToString());
objDSStatus.DataBind();
ddlStatus.DataBind();
}
DA.cs
public List<IssueStatus> GetIssueAllowedStatusByCategoryIDStatusIDandUserType(int IssueeCategoryID, int IssueStatusID, int UserType)
{
List<IssueStatus> issueStatusList = new List<IssueStatus>();
}
View 2 Replies
Nov 25, 2010
I'm a starting C# programmer and I'm experiencing the following problem.I've created a dataset in Visual Studio With a table for persons making use of two table adapters, one for selecting all persons and one for selecting one person at a time filtered by the personID (Guid). This is a seperate project of my solution. After that I created a new project for the Business Logic Layer
private PersonenTableAdapter personenAdapter = null;
protected PersonenTableAdapter Adapter
{get....}
[System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, true)]
public DAL.Testdatabase.PersonenDataTable GetPersonen()
{...}
[System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)]
public DAL.Testdatabase.PersonenDataTable GetPersonenByID(Guid ID)
{...}
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
public bool updatePersoon(string Voornaam, string Achternaam, string Geslacht, string Adres, string Huisnr, string Postcode, string Plaats, string Telnr, string GSM, string BSN, DateTime? CreateDate, string CreatedBy, DateTime? LastModifiedDate, string LastModifiedBy, bool? Actief, DateTime? DatumInactief, Guid ID)
{...}
When issueing the Update method using a detailsview with an Objectdatasource i get the following error.
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'updatePersoon' that has parameters: Voornaam, Achternaam, Geslacht, Adres, HuisNr, Postcode, Plaats, Telnr, GSM, BSN, CreateDate, CreatedBy, LastModifiedDate, LastModifiedBy, Actief, DatumInactief, original_ID.
View 1 Replies
Feb 3, 2010
I am getting error : ObjectDataSource 'ObjectDataSource1' could not find a non-generic method What would be the possible cause / solution for this error.This error is coming when call below method ObjectDataSource1.SelectMethod = "MethodName"// thr r some more code after that, although not much irrelevant
en call Server.Transfer("NewPage.aspx", True);
View 2 Replies
Mar 11, 2010
error "ObjectDataSource 'ObjectDataSourceCaseDetails' could not find a non-generic method". I have an update method and my ObjectDataSource is hooked up to the method in my BLL. review my code below
[Code]....
[Code]....
View 1 Replies
Jan 26, 2011
I try to update the detailview control. got this error messsage.
ObjectDataSource 'odsDetail' could not find a non-generic method 'Update' that has parameters: hospitalID, hospitalName, taxID, address1, address2, city, state, zip.
[Code]....
here's my edit function
[Code]....
View 3 Replies
Jan 8, 2010
Most likely the later, I think. In my page I have a GridView, DatailsView, and the ODS. None of my commands work. For the Udate command I get a an error "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateVirtual' that has parameters: name, notes, active, original_ident." For the Delete command I get "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'DeleteVirtual' that has parameters: ident, original_ident." Yet the Insert command in the DetailsView works fine. Originally I've copied a file that performs virtually identical task, the only difference is a different database and the Select command. I had the Delete command working for for while but that one too broke. Can someone point out what I'm doing wring?
Below is the code:
The *.aspx file:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Maintain_Virtual_Users.aspx.cs" Inherits="Maintain_Virtual_Users" Title="Maintain Accounts" StylesheetTheme="Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2>
Maintain Virtual Users</h2>
<p>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="ident"
DataSourceID="ObjectDataSource1" AutoGenerateDeleteButton="false"
AutoGenerateEditButton="False">
<Columns>
<asp:BoundField DataField="ident" HeaderText="ident" SortExpression="ident"
ReadOnly="True" />
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
<asp:BoundField DataField="notes" HeaderText="notes" SortExpression="notes" />
<asp:CheckBoxField DataField="active" HeaderText="active"
SortExpression="active" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
</asp:GridView>
</p>
<p>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ident"
DataSourceID="ObjectDataSource1" Height="50px" Width="393px"
DefaultMode="Insert" AutoGenerateInsertButton="False">
<Fields>
<asp:BoundField DataField="ident" HeaderText="ident" ControlStyle-Width="250"
SortExpression="ident" ReadOnly="True" >
</asp:BoundField>
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
<asp:BoundField DataField="notes" HeaderText="notes" SortExpression="notes" />
<asp:CheckBoxField DataField="active" HeaderText="active"
SortExpression="active" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="DeleteVirtual" InsertMethod="AddVirtual"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetVirtual"
TypeName="VirtualPeopleBLL" UpdateMethod="UpdateVirtual">
<DeleteParameters>
<asp:Parameter Name="ident" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ident" Type="Int32" />
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="notes" Type="String" />
<asp:Parameter Name="active" Type="Boolean" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ident" Type="Int32" />
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="notes" Type="String" />
<asp:Parameter Name="active" Type="Boolean" />
</InsertParameters>
</asp:ObjectDataSource>
</p>
</asp:Content>
the .BLL:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using dsVirtualPeopleTableAdapters;
[System.ComponentModel.DataObject]
public class VirtualPeopleBLL
{
private VirtualPeopleTableAdapter _virtualPeopleAdapter = null;
protected VirtualPeopleTableAdapter Adapter
{
get
{
if (_virtualPeopleAdapter == null)
_virtualPeopleAdapter = new VirtualPeopleTableAdapter();
return _virtualPeopleAdapter;
}
View 2 Replies
Feb 22, 2010
I've got a old working project. But i like to work in 2008 with it.
So i've made a new clean project.
And imported the code, also the .cs files with the classes, the thing, i could not add a ASP.Net Folder for the App_Code (strange?).
So i made it by hand, maybe thats the problem... ?
But if i try to run the project coud'nt find the classes, while they are there, in the App_Code folder.
View 4 Replies
Feb 15, 2011
I have an Updatepanel inside hidden Div, but I am getting "Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder_ctl04_UpdatePanel1'. I am trying to show and hide this panel from code behind. Here is my code.
<div id="div1" runat="server" style="display:none">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table id="Table1">
<tr>
<td>
<telerik:RadComboBox ID="RadComboBox1" runat="server"
AutoPostBack="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
</telerik:RadComboBox>
</td>
<td valign="top">
<asp:Button ID="button1" runat="server" OnClick="button1_Click" Text="Test1"
/><br />
<asp:Button ID="button2" runat="server" OnClick="button2_Click" Text="Test2"
/>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
View 1 Replies
Mar 12, 2010
I've got a page with two ContentPlaceHolders. In first there is UpdatePanel with GridView. In second I located DropDownList which is trigger for UpdatePanel.
<asp:UpdatePanel ID="stanUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
GridView & other stuff
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ATDropDownList"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Running the page causes error: "Control with ID 'ATDropDownList" could not be found for the trigger in UpdatePanel". I thought it was because the ATDropDownList is located inside ContentPlaceHolder. So I changed ATDropDownList's ID to UniqueID as follow:
<asp:AsyncPostBackTrigger ControlID="ctl00$ContentPlaceHolder2$ATDropDownList" (...)>
Everything works good, but I want to change it from page's code-behind. I tried to put
[Code]....
somewhere in code, but without luck so far.
View 6 Replies
Feb 21, 2011
in developing charts(graphs in vb.net with asp.net ), i am not finding graph controls in my environment.
View 1 Replies
Nov 16, 2010
I have installed VS 2008 and then i installed sql server 2005 with reporting services. But i couldn't find the Business intelligence projects template in VS 2008. Suprisingly i could find the Business intelligence project template in VS 2005 which was installed automatically when i installed Sql Server 2005 and there ware no other project types like Visual C# etc.show me a way to get the Business intelligence projects template in VS 2008.
View 1 Replies
Nov 30, 2010
I've got a asp.net web application, but if i try to publish it i get this error:Error 210 Copying file objDebugPackagePackageTmpimagesaanhalingsteken1.png to bjDebugPackagePackageTmpobjDebugPackagePackageTmpimagesaanhalingsteken1.png failed. Could not find file 'objDebugPackagePackageTmpimagesaanhalingsteken1.png'. 0 0 I've deleted this image, so what to do so the project can be build well ?Is there a collection of images somewhere?
View 2 Replies
Sep 8, 2010
I'm trying to display images in a GridView (yes, still this...). [edit] Before I can come to that I have to upload some images to the database.
I've followed this tutorial for the "upload image to database" code (this worked fine for uploading images, but I don't know if the images were converted to byte):
[URL]
and I've followed this tutorial for the "display images in gridview" code (and "retrieve file" from the tutorial below).
[URL]
It doesn't quite work, the GridView shows but without images
Now I'm trying to change the "save file" code according to this tutorial:
[URL]
but I don't understand everything in it. When I try to upload an image I get an error on this line:
[Code]....
View 40 Replies
May 25, 2010
I have anywhere from 5 to 10 generic list in an ASP.NET VB.NET web app. I would like to write a method to pass them all into, and return only the elements they all have in common.
View 2 Replies
Dec 4, 2010
I have a DetailsView control about a store products.
When I hit the "Edit" button of the DetailsView control, I want to bind a DropDownList to list products categories and select the current product category in it.
I used the method "ModeChanged" to select the current product category like this:
[Code]....
the FindControl method DOES NOT find the "ddlCategory" (returns null) although it's present in the EditTemplateField.
I'm thinking to use "DropDownList's PreRender" event for doing the purpose I aim, but I want to know what is wrong!
View 1 Replies
Apr 30, 2010
I have a few web applications that I maintain and I find myself very often writing the same block of code over and over again to bind a GridView to a data source. I'm trying to create a Generic method to handle data binding but I'm having trouble getting it to work with Repeaters and DataLists.
Here is the Generic method I have so far:
[code]....
That way I can just define my CommandText then make a call to "BindControls(myGridView, cmd)" instead of retyping this same basic block of code every time I need to bind a grid.
The problem is, this doesn't work with Repeaters or DataLists. Each of these controls inherit their respective "DataSource" and "DataBind" methods from different classes. Someone on another forum that I implement an interface, but I'm not sure how to make that work either.
The GridView, Datalist and Repeater get their respective "DataBind" methods from BaseDataBoundControl, BaseDataList, and Repeater classes. How would I go about creating a single interface to tie them all together? Or am I better off just using 3 overloads for this method?
View 2 Replies
Jun 1, 2010
In one of the methods I'm using in my MVC app, there's a param that accepts a list collection of strings. If I have a string parameter, I can give it a default value of an empty string, but I cannot seem to give the list collection a default value of a new, empty list collection. I get the error that's beginning to seriously grate on my nerves about requiring a compile-time constant. getting the generic list to work with a default empty set?
View 5 Replies
May 17, 2010
I'm trying to increase the execution timeout and file upload limit on my asp.net website but when i try to add
<httpRuntime
executionTimeout="110"
maxRequestLength="4096">
</httpRuntime>
i get the following errors:
Could not find schema information for the element 'httpruntime'.
Could not find schema information for the element 'executionTimeout'.
Could not find schema information for the element 'maxRequestLength'.
According to this msdn library link this is how I'm supposed to do it,so what am I missing here?
View 1 Replies
Apr 29, 2010
Is there a generic control that can be added to all aspx pages that checks for silverlight plugin and the version.. I know there is javascript and the silverlighthost object tag that accomplishes this. Is there an existing ascx control that wraps this functionality ? I need to be able to set the path to the xap on each page (via a property on the ascx control).
View 2 Replies
Mar 10, 2010
I dont know what I have done but my add blog or news item functionality is broken. It works fine locally but not on the server (.net 3.5 mvc 2 I believe).
[Code]....
The interesting thing is the path P:Web_DevelopmentAHNDEVControllersAdministratorController.vb. This is my local path on my machine but not the
View 16 Replies
Apr 23, 2010
I have several custom classes that derive from a common base class so they share several members in common. I would like to be able to pass objecs from any of these three classes to a function that will "look at" common properties. However, it seems there is a catch 22 -- When I try to access a member (.FirstName) of the passed object, the computer reports an error that it thinks the member doesn't exist.
It seems to be a sort of contradiction -- since I didn't declare the type, the computer can't confirm existence, but it seems that it should have to take it on faith since the generic character of the type is specified by the code. Possibly there is something I don't know about that would fix this. I'm showing VB code for what I have so far. I went ahead and hardcoded an instance to confirm that the object exists and has the needed property. I commented out the line that had the code that resulted in the computer reporting an error.
[Code]....
View 2 Replies
Mar 14, 2011
[Code]....
[Code]....
The GetList method is as folllowing:
[Code]....
Now i can populate my gridview trough code by this: //gvwDiensten.DataSource = new BindingList<diensten>(dataManager.GetList<diensten>().ToList());But i would like to use an objectdatasource, so i created this:
[Code]....
</asp:ObjectDataSource>
But when running the page i get:
ObjectDataSource 'dsDiensten' could not find a non-generic method 'GetList' that has no parameters.
View 5 Replies
Oct 1, 2010
Is something like the below possible?
public static T Sum<T>(this DataTable dt, string columnName)
where T : IEnumerable<decimal>, IComparable<decimal>[code]....
It feels like i'm almost there, but not quite :/
Just trying to sum up either decimal or int values in a column in datatable. Currently getting a compile error, however think this is due to the incorrect generic constraint.
View 3 Replies