About the author

Vijay Kodali
E-mail me Send mail

Site Statistics

Site Meter

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2014

Unable to update the EntitySet '' because it has a DefiningQuery and no element exists in the element to support the current operation.

Error Message:

 Unable to update the EntitySet 'TableName' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

 

Solution:

Make sure that table Primary key column. If not add one, that should fix this error


Posted by vijay on Saturday, January 22, 2011 5:01 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Disabled button not grayed out in Firefox and Chrome

When button is disabled, it’s not-clickable in all browsers. However in Firefox and Chrome, the button looks enabled, though the user cannot click it.

Reason:

From W3Scholl, "Enabled" Property isn't standard property of XHTML 4.

Solution:

You can modify the way they look with CSS

button[disabled] { 
 color:Grey;
/* Add other  styles here for disable button */ 
} 

Posted by vijay on Thursday, August 12, 2010 9:08 PM
Permalink | Comments (3) | Post RSSRSS comment feed

To access local IIS Web sites, you must install the following IIS components: Internet Information Services IIS 6 Metabase and IIS 6 Configuration Compatibility

If you are getting following error after converting asp.net project to latest version..

To access local IIS Web sites, you must install the following IIS components: Internet Information Services IIS 6 Metabase and IIS 6 Configuration Compatibility

Try this solution:

open Control Panel, click Programs and Features

WindowsFeatures

Expand Web Management Tools, expand IIS 6 Management Compatibility, and then select the IIS 6 Metabase and IIS 6 configuration compatibility check box.

IIS 6 Metabase and IIS 6 configuration compatibility


Expand World Wide Web Services, expand Application Development Features, and then select the ASP.NET check box.

aspNet

 

To enable Visual Studio to debug applications, you must configure IIS 7.0 with the Windows Authentication module. Expand World Wide Web Services, expand Security, and then select the Windows Authentication check box.

 

WindowdsAuthentication

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


Categories: ASP.NET | ASP.Net 3.5 | Windows 7
Posted by vijay on Thursday, April 08, 2010 3:01 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Check if variable is number in C#

            string s ="45";
            int i;
            bool isNum = int.TryParse(s.ToString(), out i); 
 
            if (isNum)
                Response.Write(i); //integer 
            else
                Response.Write("Not an interger");

Categories: ASP.NET | C#
Posted by vijay on Thursday, June 18, 2009 9:27 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Hide GridView AutoGenerate Columns

            //hide header column
            GridView1.HeaderRow.Cells[0].Visible = false;

            //hide column in data rows
            foreach (GridViewRow row in GridView1.Rows)
            {
                row.Cells[0].Visible = false;
            }

Categories: ASP.NET | ASP.Net 3.5
Posted by vijay on Thursday, March 26, 2009 8:37 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Ajax AutoCompleteExtender not working

Make sure you have indicated that a Web service can be invoked from script..

 
    [System.Web.Script.Services.ScriptService]
    public class AutoCompleteService : System.Web.Services.WebService
    {
 
        //[WebMethod]
        //public string HelloWorld()
        //{
        //    return "Hello World";
        //}
    }


Categories: Ajax Toolkit | ASP.NET
Posted by vijay on Thursday, March 12, 2009 9:57 AM
Permalink | Comments (0) | Post RSSRSS comment feed

onblur bug with RequiredFieldValidator and Google chrome browser

I came across a bug with Google chrome ver 1.0.154.43 while answering a problem in asp.net forums.

Problem:

Chrome browser ignores "onblur" event function for input box while it has Required field validator attached to it . Check this code..

  <input id="txt1" runat="server" type="text" maxlength="16" style="width: 127px" onblur= "formatSSN();"/>
  <asp:RequiredFieldValidator ID="Rfssn" runat="server" ControlToValidate="txt1" Display="None" ErrorMessage="SSN" 
     SetFocusOnError="True" EnableViewState="False">
  </asp:RequiredFieldValidator>
  <script language="javascript" type="text/javascript">
   function formatSSN() 
  {
    var ssn = document.getElementById("txt1").value;
    if(ssn.length == 9) 
        {
            document.getElementById("txt1").value= ssn.substring(0, 3) +"-" + ssn.substring(3, 5) + "-" + ssn.substring(5, 9); 
            return false;
        }
  }
  </script> 

The code works fine in IE6/7 & FireFox3, but not in Google chrome .

Solution:

I think the problem is with required field validator's SetFocusOnError property. Setting SetFocusOnError="false" for Rfv will fix it in chrome.


Posted by vijay on Saturday, January 24, 2009 8:15 PM
Permalink | Comments (5) | Post RSSRSS comment feed

Validate Asp.Net FileUpload control

Here is an example to validate Fileupload control. This validation will check user to upload files of particular type/extension.

Client side validation:

 

<asp:FileUpload ID="UploadFile" runat="server" />
<asp:Button Text="Save" ID="btnSave" runat="server" OnClientClick="javascript:return ValidateUpload();" />     
 <script type="text/javascript" language="javascript">
    function ValidateUpload()
            {           
                var Upload_file = document.getElementById('<%= UploadFile.ClientID %>');                
                var myfile = Upload_file.value;               
                if(myfile.indexOf("doc")>0)
                {
                 alert('Valid Format');
                }
                else
                {
                 alert('Invalid Format');
                }            
            }
 </script>
Validating with RegularExpression validator:
<asp:FileUpload ID="UploadFile" runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Only Doc files are allowed" 
ControlToValidate="UploadFile" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.doc|.DOC)$">
</asp:RegularExpressionValidator>

In this example, I checked  ".doc" file type but you can use this example for any file type. Just replace ".doc" with file type you would  like to check( "Xml", "wmv"...).


Categories: ASP.NET | ASP.Net 3.5
Posted by vijay on Thursday, October 16, 2008 8:26 PM
Permalink | Comments (3) | Post RSSRSS comment feed

jQuery now officially part of the .NET toolbox

Microsoft is going to make jQuery part of the official dev platform. JQuery will come with Visual Studio in the long term, and in the short term it'll ship with ASP.Net MVC. It is truly good news for ASP.Net developers

What is jQuery?

jQuery is a lightweight open source JavaScript library.

From jQuery website..

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

Blogs posts by Scott Guthrie and Scott Hanselman on this topic.


Posted by vijay on Tuesday, September 30, 2008 7:11 PM
Permalink | Comments (0) | Post RSSRSS comment feed

ASP.NET page rendering problems in FireFox and other browsers

I see questions asked frequently about FireFox rendering problems in Asp.Net forums.

What is "rendering engine"?

A rendering engine, also known as a layout engine, is the code that tells the browser how to display web content and available style information in the browser window

Here are some options to solve those:

  1. Always check  rendered web pages for XHTML compatibility using the W3C tests at   http://validator.w3.org . Most issues will fixed by fixing all non standards compliant HTML.
  2. Set clientTarget="UpLevel" in Page Directive. This will override automatic detection of browser capabilities and specifies how a page renders for particular browser clients.
  3. Here is link to a guide to make your page as accessible as possible.   http://www.anybrowser.org/campaign/abdesign.html

Categories: ASP.NET | ASP.Net 3.5
Posted by vijay on Thursday, September 25, 2008 7:43 PM
Permalink | Comments (0) | Post RSSRSS comment feed