Asheej Kommery's .NET blog
-
Can we have primary key and clustered index on same table with different field?
Can we have primary key and clustered index on same table with different field?
-
After login how to go back to the last visited page in ASP.NET
This is one of the common question I always see in .NET forums, especially by beginners.
-
How to remove HTML tag from a string using asp.net
This is one of the very usefull code to remove the HTML tag from a string containing HTML tags.
-
System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase. The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
-
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
" Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack" - This is one of the common error we see in forum where people request solution for it.
-
How to find foreign key relationship between tables in the MS SQL database
-
Validate file Extension in ASP.net using JavaScript
I had seen many post in forums people asking how to make sure only image files or only .doc file or .xls file should be uploaded or selected.
Below is a simple JavaScript function which make sure that only the extension specified is valid during upload/selection process.
Here I am using Custom validator to call the function. You can use this JavaScript directly on click of a button or FileUpload control.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function ValidateFile(Source, args)
{
var FileUploadCtrl = document.getElementById('FileUpload1');
var FilePath = FileUploadCtrl.value;
//
var Extension = FilePath.substring(FilePath.lastIndexOf('.') + 1).toLowerCase();
if (Extension == "jpg" || Extension == "gif" || Extension == "png")
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Please select a valid doc or jpeg file"
ControlToValidate="FileUpload1" ClientValidationFunction="ValidateExcelFile"></asp:CustomValidator>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html> -
How to merge two datatables in ASP.NET
-
Error loading the Changeset Comments Policy in TFS
Below is one of the common error we see when we use TFS,
-
AJAX Accordion Control - Multiple controls with the same ID '_header' were found. FindControl requires that controls have unique IDs.
This is one of the common error we get when you use multiple panes in Accordion control.