Geeks With Blogs

News


Google RankGoogle PR™ - Post your Page Rank with MyGooglePageRank.com



The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.

Disclaimer:- All postings in this blog is provided "AS IS" with no warranties, and confers no rights.
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in. April 2008 Entries
URL rewrtting
UrlRewriting is one of the interesting and advance topics in ASP.Net, following is the link shows the comprehensive information on URLRewriting. Scott has give a fantastic detailed article on URL Rewriting. here http://weblogs.asp.net/scot... http://msdn.microsoft.com/a... The following link is the example with source code available http://urlrewriting.net/en/... ......

Posted On Thursday, April 17, 2008 7:02 PM

Failed to access IIS metabase problem
Possible Cause:- When you install IIS AFTER .NET 2.0 framework, the rights of the ASPNET user had not been set correctly. Resolution Repair (Uninstall if repair does not work for you) .NET Framework 2.0 Simply run the following from command line to reset the IIS registry settings for aspnet user. Usually framework directory for .Net Framework 2.0 resides under C:\WINDOWS\Microsoft.NET\Fr... ......

Posted On Thursday, April 17, 2008 7:01 PM

Delete confirmation
Javascript <script language="javascript" type="text/javascript"> function ConfirmDelete() { if(confirm("Do you really want to Delete the Abused Record?")==true) { return true; } document.getElementById('&l... return false; } function ClearMessageLabel() { var msg=document.getElementById... if(msg!=null) { msg.innerHTML=""; } } </script> Cs code btnDelete.Attributes.Add("o... "javascript:return ConfirmDelete('" + CommonFunction.GetErrorMess... ......

Posted On Wednesday, April 16, 2008 11:15 PM

Fix for Sys.WebForms.PageRequestManagerParserErrorException + Ajax
Well while implementing Ajax i had received error due to Sys.WebForms.PageRequestMan... the best solution that i could figure out to over come is catch this exception and byPass it.. if any body has a good way of catching this exception why this arise Please do let me know. i has to modify the script <script type="text/javascript"> Sys.WebForms.PageRequestMan... (sender, args) { if (args.get_error()!=null) { if (args.get_error().name ......

Posted On Wednesday, April 16, 2008 10:50 PM

Displaying Image in a Popup
Javascript <script language="javascript" type="text/javascript" > function openPopUp(sPicURL) { var win=window.open(sPicURL, "","menubar=no,scrollbar=ye... return false; } function openImagePopUp(sPicURL) { window.open("../common/cont... "","width=250px,height=180p... } </script> Cs code imgPhoto.Attributes.Add("on... "javascript:openImagePopUp('" + strPath + "');"); ......

Posted On Wednesday, April 16, 2008 10:37 PM

Passing Multiple Fields With GridView HyperLink Column
Below is the solution <asp:GridView ID="gvSubject" runat="server" > <Columns> <asp:HyperLinkField DataTextField="CategoryName" DataNavigateUrlFields="Subj... DataNavigateUrlFormatString... /> </Columns> </asp:GridView> ......

Posted On Monday, April 7, 2008 11:42 PM

Simple procedure using transaction
Begin Begin Tran --Inserting values member details into ServGeneralUser Table Insert into ServGeneralUser(LoginName,P... values (@LoginName,@Password,@Emai... -- reteriving Currently Inserted Members User Id into local variable @userId select @userId=ident_current('Serv... ......

Posted On Sunday, April 6, 2008 11:45 PM

Checks Image Exist at an URL
public static bool CheckImageExist(string strImageURL) { bool blnImageExist = true; System.Net.HttpWebRequest httpImageRequest = null; System.Net.HttpWebResponse httpImageResponse = null; // Sends the HttpWebRequest and waits for the response. try { httpImageRequest = (System.Net.HttpWebRequest)... httpImageResponse = (System.Net.HttpWebResponse... } catch (Exception ex) { blnImageExist = false; } return blnImageExist; } ......

Posted On Sunday, April 6, 2008 10:30 PM

WrapCharacters
WrapCharacters public static string WrapCharacters(object objstr, int intNum) { if (objstr == System.DBNull.Value) { return ""; } string str = (string)objstr; int intLen = str.Length / intNum; int intInsertedChars = 0; if (intLen < 1) { return str; } int intStartIndex = 0; if (str.IndexOf(" ", 0) < intNum && str.IndexOf(" ", 0) != -1) { intStartIndex = str.IndexOf(" ", 0) + 1; intLen = str.Length - intStartIndex; intLen = intLen / intNum; } for (int intCount = 0; intCount < intLen; ......

Posted On Sunday, April 6, 2008 10:27 PM

Encrypts the string to a byte array using the MD5 Encryption Algorithm + C#
Encrypts th string to a byte array using the MD5 Encryption Algorithm public static string MD5Encryption(string strToEncrypt) { string strEnctypted = string.Empty; // Create instance of the crypto provider. MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); // Create a Byte array to store the encryption to return. byte[] hashedbytes; // Required UTF8 Encoding used to encode the input value to a usable state. UTF8Encoding textencoder = new UTF8Encoding(); // let the show begin. hashedbytes ......

Posted On Sunday, April 6, 2008 10:27 PM

Cross Page Postbacks on a GridView control
Nice Link

http://www.codeproject.com/KB/aspnet/GridViewCrossPagePostBack.aspx

Posted On Sunday, April 6, 2008 10:26 PM

Validation in CS Page file
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressi... namespace PortalUtilities { /// <summary> /// This Class is used for Validation Check for the controls /// </summary> public class Validation { #region IsNaturalNumber Method /// <summary> /// Function to test for Positive Integers. /// </summary> /// <param name="strNumber"></pa... /// <returns></returns... public bool IsNaturalNumber(String strNumber) ......

Posted On Thursday, April 3, 2008 8:11 PM

Javascipt code on the pop up page
2 Javascipt code on the pop up page//////////////////// Button1.Attributes.Add("onc... "javascript:return closeBrowser(1);"); Button2.Attributes.Add("onc... "javascript:return closeBrowser(2);"); function for closing the browser and taking the value in a hidden control function closeBrowser(val) { // alert(window.opener.documen... // window.opener.document.form... = val; if (val == 1) { window.returnValue ......

Posted On Thursday, April 3, 2008 8:11 PM

Javascipt code on the pop up page
2 Javascipt code on the pop up page//////////////////// Button1.Attributes.Add("onc... "javascript:return closeBrowser(1);"); Button2.Attributes.Add("onc... "javascript:return closeBrowser(2);"); function for closing the browser and taking the value in a hidden control function closeBrowser(val) { // alert(window.opener.documen... // window.opener.document.form... = val; if (val == 1) { window.returnValue ......

Posted On Thursday, April 3, 2008 8:07 PM

Javascript Function for date validation
Javascript Function for date validation function checkDate() { var myDayStr = document.getElementById('dd... var myMonthStr = parseInt(document.getElemen... var myYearStr = document.getElementById('dd... var dteDate; dteDate=new Date(myYearStr,myMonthStr,m... var valid= ((myDayStr==dteDate.getDate()) && (myMonthStr==dteDate.getMon... && (myYearStr==dteDate.getFull... var myDateStr = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; ......

Posted On Thursday, April 3, 2008 8:06 PM

Javascript Function for Select All CheckBox functionality..
Javascript Function for Select All CheckBox functionality.. <script language="javascript" type="text/javascript"> function SelectAll(CheckBoxControl) { var ctrlName; if (CheckBoxControl.id=='chkAl... { ctrlName="chkLocations"; } if (CheckBoxControl.checked == true) { var i; for (i=0; i < document.forms[0].elements.... i++) { if ((document.forms[0].element... == 'checkbox') && (document.forms[0].elements... > -1) ) { var str = new String(document.forms[0].el... ......

Posted On Thursday, April 3, 2008 8:05 PM

Javascript Function for Closing any popup window.
Javascript Function for Closing any popup window. ASPX CODE <script language="javascript" type="text/javascript"> function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWin... oWindow = window.frameElement.radWindow; return oWindow; } function CancelEdit() { GetRadWindow().Close(); GetRadWindow().BrowserWindo... return false; } onclick="javascript: CancelEdit();" [u can use it on aspx as shown here or ......

Posted On Thursday, April 3, 2008 8:04 PM

Close Child Pop-up on Closing Parent Window
Javascript to be Used <script type="text/javascript"> function TrackParent() { var timeout; try { if(window.opener.parent); { timeout= self.setTimeout('TrackParen... } } catch(e) { this.close(); } } </script> On Master Page Add this on body tag <body onload="TrackParent();"> ......

Posted On Thursday, April 3, 2008 7:19 PM

Save Multiple check box value
/// <summary> /// update rights of Coverage area(Refer functionality save multiple checkbox functionality) /// </summary> /// <param name="sender"></param... /// <param name="e"></param> protected void btnCopy_Click(object sender, EventArgs e) { TerminalCatalogConfig objTerminalCatalogConfig = new TerminalCatalogConfig(); Hashtable htbParam = new Hashtable(); DataSet dsChk = new DataSet(); int LocationId; for (int iCtr = 0; iCtr < grdLocation.Items.Count; iCtr++) ......

Posted On Thursday, April 3, 2008 7:10 PM

Adding Days to Date

string date(start date is 1 week later than todays date.)

string sDate = DateTime.Now.Date.AddDays(-7).ToShortDateString();

string eDate = DateTime.Now.Date.ToShortDateString();

Posted On Thursday, April 3, 2008 7:09 PM

Disabling back button
disabling back button public void DisableBrowserBack() { Response.Write("<script&... } ......

Posted On Thursday, April 3, 2008 7:08 PM

check for user authentication and session expiry
To check for user authentication and session expiry On POPUP PAGE Call this function on Pageload. IsUserAuthorizedinPopUp(Con... /// <summary> /// To check for user authentication and session expiry /// </summary> /// <param name="userId"></param... /// <returns></returns... public bool IsUserAuthorizedinPopUp(string userId) { bool continueFlag = false; if ((userId == "") || (userId == "0")) { RadAjaxPanel1.ResponseScrip... ......

Posted On Thursday, April 3, 2008 7:03 PM

Check All Functionality in Grid
Using Rad Grid /// <summary> /// Rows Check box check event. /// </summary> /// <param name="sender"></param... /// <param name="e"></param> protected void chkItemChecked_CheckedChang... sender, EventArgs e) { try { ((sender as CheckBox).Parent.Parent as GridItem).Selected = (sender as CheckBox).Checked; AssignedHeaderCheckBoxState... as CheckBox).Checked); } catch (Exception ex) { throw ex; } } /// <summary> /// Header check box click event select/Unselect ......

Posted On Thursday, April 3, 2008 7:01 PM

Passing Multiple value in Command Argument
ASPX code: using Rad grid <radg:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Zip Code Count" DataField="ZipCount" > <ItemTemplate> <asp:LinkButton runat="server" ID="lnkZipCount" Text='<%#Eval("ZipCount") %>' CommandArgument='<%#Eval... + ";" +Eval("Sname")%>' OnClick="lnkZipCount_Click"... </ItemTemplate> </radg:GridTemplateColum... Cs code protected void lnkFunctionalGroup_Click(ob... sender, EventArgs e) { LinkButton ......

Posted On Thursday, April 3, 2008 6:59 PM

FAQ on Sql Server
What is normalization? Explain different levels of normalization? Check out the article Q100139 from Microsoft knowledge base and of course, there's much more information available in the net. It'll be a good idea to get a hold of any RDBMS fundamentals text book, especially the one by C. J. Date. Most of the times, it will be okay if you can explain till third normal form. What is denormalization and when would you go for it? As the name indicates, denormalization is the reverse process of normalization. ......

Posted On Thursday, April 3, 2008 12:26 AM

Simple Questions on .NET
When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET. When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was ......

Posted On Wednesday, April 2, 2008 10:43 PM

Paging in Datalist + custom Paging + .Net
Here is an Example using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Text; using System.IO; using System.Net; using System.Web.UI.WebControls; using System.Web.UI.WebControls.W... using System.Web.UI.HtmlControls; public partial class ProfileApproval_PhotoGaller... : System.Web.UI.Page { // variables decleration ApprovalUserDetailsBAL objUserDetailBAL = null; string strUserType ......

Posted On Wednesday, April 2, 2008 10:18 PM

Code Access Security (CAS)
Code Access Security (CAS) Ask any typical .NET developer about Code Access Security (CAS) and you've got the chance of hearing "Huh?" as the response. Most developers haven't run into CAS at all—let alone in a way that would cause them to develop a deep understanding of it. Ask your typical SharePoint developer about CAS and they're likely to begin to shudder uncontrollably. Why is that? Well, SharePoint developers have been dealing with CAS since the day that SharePoint was released. Unlike ASP.NET, ......

Posted On Wednesday, April 2, 2008 9:32 PM

Authentication in ASP.NET
Authentication in ASP.NET There are two closely interlinked concepts at the heart of security for distributed applications - authentication and authorization. Authentication is the process of obtaining some sort of credentials from the users and using those credentials to verify the user’s identity. Authorization is the process of allowing an authenticated user access to resources. Authentication is always precedes to Authorization; even if your application lets anonymous users connect and use the ......

Posted On Wednesday, April 2, 2008 8:56 PM

New in Visual Studio 2008
What is new in Visual Studio 2008 A quick list of some of the new features are: Multi-Targeting support Web Designer and CSS support ASP.NET AJAX and JavaScript support Project Designer Data LINQ – Language Integrated Query The features listed and explained in this paper are not complete and this document intends to give you a forehand to start off with VS 2008. 1. Multi-Targeting Support Earlier, each Visual Studio release only supported a specific version of the .NET Framework. For example, VS ......

Posted On Tuesday, April 1, 2008 11:27 PM

Features in .Net 3.0
A Preview of What is New in C# 3.0 On the heels of the Visual Studio 2005 and C# 2.0 releases, Microsoft has given a sneak preview of what to expect in the version after the next: C# 3.0. Even though C# 3.0 is not even standardized yet, Microsoft provided a preview release at its Professional Developers Conference (PDC) in September so eager developers could try out some of the expected features. This article discusses the following major new enhancements expected in C# 3.0: Implicitly typed local ......

Posted On Tuesday, April 1, 2008 11:24 PM

Function to convert DateTime to MM/DD/YYYY format + SQL SERVER
Function to convert DateTime to MM/DD/YYYY format

CreateFUNCTION [dbo].[tkfunConvertDateToMMDDYYYY](@dtDate varchar(10))
    RETURNS VARCHAR(10)
AS
BEGIN
    RETURN substring(@dtDate,4,2)+'/'+substring(@dtDate,1,2)+'/'+substring(@dtDate,7,4)
END

Posted On Tuesday, April 1, 2008 9:41 PM

Function to Convert DateTime to DD/MM/YYYY format + SQL SERVER
Function to Convert DateTime to DD/MM/YYYY format

CreateFUNCTION [dbo].[tkfunConvertDateToDDMMYYYY](@dtDate varchar(10))
    RETURNS datetime
AS
BEGIN
    RETURN Convert(datetime,substring(@dtDate,4,2)+'/'+substring(@dtDate,1,2)+'/'+substring(@dtDate,7,4))
END

Posted On Tuesday, April 1, 2008 9:40 PM

Remove Special Character from XML string + sql Server
Remove Special Character from string -- ===========================... -- Author: <Author,,Name> -- Create date: <Create Date, ,> -- Description: <Description, ,> -- ===========================... ALTER FUNCTION [dbo].[RemoveSpChar] ( -- Add the parameters for the function here @sInput varchar(MAX)='' ) RETURNS varchar(MAX) AS BEGIN -- Declare the return variable here DECLARE @sOutput Varchar(MAX), @iIndex int, @iLength int, @sChar varchar(1), @iASCII ......

Posted On Tuesday, April 1, 2008 9:38 PM

Split Function in SQL SERVER + sqlServer
SPLIT FUNCTION IN SQL SERVER (USER DEFINED FUNCTION) set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER FUNCTION [dbo].[fnSplit]( @sInputList VARCHAR(8000) -- List of delimited items , @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items ) RETURNS @List TABLE (item VARCHAR(8000)) BEGIN DECLARE @sItem VARCHAR(8000) WHILE CHARINDEX(@sDelimiter,@sInp... <> 0 BEGIN SELECT @sItem=RTRIM(LTRIM(SUBSTRIN... @sInputList=RTRIM(LTRIM(SUB... ......

Posted On Tuesday, April 1, 2008 9:35 PM

Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net