Tag Archives: C#

Invalid postback or callback argument ASP.NET

I got this error Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation=”true”/> in configuration or <%@ Page EnableEventValidation=”true” %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Looping through gridview in C# always return empty

I had a gridview which was bounded to a datasource (datatable in my case) in code behind in C#. Code was something like this foreach (GridViewRow Row in GV_Items.Rows) { string str = Row.Cells[0].Text; } This was always returning empty … Continue reading

Posted in Tutorials/Tips | Tagged , | Leave a comment

invoke delegate with parameters

Download Ping Example Code (10kb) The following is a simple code to invoke a delegate with parameter. I created this to update label control on the form asynchronously. I did not quite work I was hoping for but the code … Continue reading

Posted in Tutorials/Tips | Tagged , , , | 1 Comment

RAISERROR and Exceptions

RAISERROR with severity level below 10 are not catched by ADO framework. To fix it simply raise severity level to 10 or above or you can instead use THROW statement which has severity level of 16 by default and will … Continue reading

Posted in Tutorials/Tips | Tagged , , | Leave a comment

executenonquery returns -1 on success

ExecuteNonQuery is suppose to return the number of rows inserted, updated or deleted but in my case it always return -1 even though the record is successfully added. Found out SET NOCOUNT OFF was missing my in my stored procedure. … Continue reading

Posted in Tutorials/Tips | Tagged , , , , , | Leave a comment

Spring.NET Constructor Injection Example

The following Console Application (C#) represents Constructor injection using Spring.NET. To use the code in as it is form, create a console application using C# in Visual Studio 2012 and name it Spring4. Copy the content of program file from … Continue reading

Posted in Software Development | Tagged , , , | Leave a comment

Accessing Local Resources in MVC

You want to localized your resource or in other words put them in a resource file in the local folder, how do you access it in MVC?   Here is how you will access it     public class Student     {       // Constuctor … Continue reading

Posted in Software Development | Tagged , | Leave a comment