.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

could not find a non-generic method 'DeleteProduct'

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net


<asp:GridView ID="ProductsGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="ID,UserId"
            OnRowUpdated="ProductsGrid_RowUpdated" AllowPaging="True" AllowSorting="True"

                                       <asp:CommandField ShowDeleteButton="True" ValidationGroup="InsertValidationControls" />
                <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID"
                    ReadOnly="True" InsertVisi

View Complete Post

More Related Resource Links

.NET Matters: Restart Manager and Generic Method Compilation


This month Stephen Toub answers questions pertaining to the Windows Vista Restart Manager API and generic method compilation.

Stephen Toub

MSDN Magazine April 2007

how to get a class reference as a reference and not a string to send for a generic method

I got some property that i get using generic method, there for I dont have it's <T>and I want to send it to another generic method but , how the heck do I get it's <T> :P?please look at the code below to understandit gets an entity framework objects, scan all it's properties and if the property is another entity framework object it would send it back to him self , the issue is that i dont know the new object <T> to send it back to him self :(search for the bold part to see what i'm missing//contains objects which we added so there wont be double adding private List<object> _addedObjects; public FakeGenericRepositoryExtension() { _addedObjects = new List<object>(); } public void Create<T>(T entity) where T : class { //add to created objects _addedObjects.Add(entity); //do something with object //... //start recircle process Type entityType = typeof(T); //run thrue each member of Type foreach (var member in typeof(Type).GetProperties()) { //get member value var member_value = member.GetValue(entity, null); //if not null //we must test this otherwise we can't get .BaseType if (member_value != null) { //get current member's base type string memberBaseType = member.GetValue(entity, null).GetType().BaseTyp

help passing generic list to method


I have several lists in one class. When I add an class/object  to a list I want to be able to check if it doesn't exist already in the list. I've done this using a method that checks the particular list individually but would require a method for each list eg

private bool checkShipList (List<Ship> ship, Ship newship)

//check list code


How can I make it so I use only one method for all lists and can pass the new object to it to check. I used List<T> in the method but can't get it right with the second parameter. Thanks for any help.

Calling a Generic WCF method



We are working with Silverlight 4 using Silverlight enabled WCF Services in VS2010, I'm using LINQ to SQL as well.
We are trying to put security inside our WCF service, we decided to use a method that validates a key inside the WCF when you try to call the WCF Service from outside our application.

We already have all methods, now we need to apply the security, my question is:

Is there any way to call a method that validates something and then returns a kind of generic object to be able to cast it to the correct one after validation? for example I have 20 services already done, I need to add something in my code for each method to validate my key and depending of the return value, return a generic object. Can I do this?

Thank you. 


Executing method of the Generic class using Reflection.



I have a generic class:

 abstract public class BaseTC<T>:IExecutable where T : Core, new()
    private Type2 testInfo;
    private Type1 settings;
    private T core = null;

and I want to load such class from library the class is located in, and create an instance of it and execute methods later on.

I know how to use non-generic classes, but no idea how to call the same with generics.

Cannot find GetModuleCatalog() - method not found to override


I am using Prism with WPF for creating a dashboard application. In the BootStrapper.cs file when trying to override IModuleCatalog GetModuleCatalog() method i get this error:

"Method not found to override."

I have added all the CAL references in the WPF project.

Can generic types be used as WCF method parameters?


Hello everyone, help me plz with one question...

If it`s possible, i would want to know some way for passing generic type as income parameter of WCF service method. In fact, i want pass a lambda expression to use it for filtering data on next tier of application. It`s needed for my own realization of custom paging data on web page, i have already found the way to pass custom SortExpression and SortOrder (and create in other place lambda expression from then for using in OrderBy/OrderByDescending). ALso i have founded the way to pass to web application only one, exactly needed page of data with full illusion of large collection objects, than also supports sorting. The last thing want is to add possibility of filtering data, and for this task it would be great to create lambda expression and pass it to the next tier for using in Where() expression before my other actions for custom paging.

I created generic datacontract that contains property of type System.Linq.Expressions.Expression<Func<TSource, bool>>, and used if as a parameter of wcf method as MyDataContract<MyCustomType>. Project compiles well, even starting (it`s a wcf service hosted in application and installed as service), but i cannot update service reference to it, it shows "The server was unable to process the request due to an internal error" page. I think, may be some prob

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

A Generic Dialog ViewModel

I worked on a wpf viewmodel for dialogs, because it seemed strange to me that you needed for instance windows forms dialogs to open or save files in wpf. So I set about creating my own wpf dialogs. After creating the dialog viewmodels there still remained a small issue with the library and also I didn't have much time to write an article about it. I however published the library containing the viewmodels for dialogs with another article on my blog

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

find a Control inside a GridView using jQuery


I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!

here is the code page: 

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">

Using CreateNewUserWizard SendingMail method to email me, not applicatnt.


I have staff area of my site I am protecting with forms authentication using c# and .Net 4.0. What I want to do is let the staff members register on the site but instead of the confermation email being sent to them I want it sent to me so I can go in and approve it. I have been trying to use the SendingMail method  but can not figure out how to get it to email me instead of the person that registered. I have searched around this site and find many topics on the SendingMail method but none seem to properly address my issue. Can anyone help me out?

Is there any way to find out the reason for session expiry?


Dear All,

is there any way to find out the reason for session expiry?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend