Skip to main content

Posts

Showing posts from May, 2008

Custom Paging Sorting!

Grid View Manual Paging:- protected void GrdDesign_PageIndexChanging(object sender, GridViewPageEventArgs e) { GrdDesign.PageIndex = e.NewPageIndex; GrdDesignBind(); } Grid View Manual Sorting Using Data View. :- public SortDirection GridViewSortDirection { get { if (ViewState["sortDirection"] == null) ViewState["sortDirection"] = SortDirection.Ascending; return (SortDirection)ViewState["sortDirection"]; } set { ViewState["sortDirection"] = value; } } protected void GrdDesign_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression = e.SortExpression; if (GridViewSortDirection == SortDirection.Ascending) { GridViewSortDirection = SortDirection.Descending; SortGridView(sortExpression, DESCENDING); } else { GridViewSortDirection = SortDire...

Image Upload!

File Uploading :- if (FileUpdThumbImage.PostedFile.ContentLength > 0) { if (FileUpdThumbImage.PostedFile.ContentLength > Convert.ToInt32(ConfigurationManager.AppSettings["DesignThumImageSize"])) { lblMsg.Text = GetLocalResourceObject("strMsgSizeThumb").ToString(); return; } string StrImagenameThumb; Boolean blnFileUpload; //User Id is taken as static blnFileUpload = SaveImageThumbOnFileSystem(UserID, FileUpdThumbImage, "Design", out StrImagenameThumb); if (blnFileUpload== false ) { lblMsg.Visible = true; lblMsg.Text = GetLocalResourceObject("strMsgCheckthumb").ToString(); return; } prop.DesignThumbImg = StrImagenameThumb; } creating Direc...

Javascript Functions

Java Script Function For Check Box :- if (e.Row.RowType == DataControlRowType.Header) { //Find the checkbox control in header and add an attribute ((CheckBox)e.Row.FindControl("cbSelectAll")).Attributes.Add("onclick", "javascript:SelectAll('" + ((CheckBox)e.Row.FindControl("cbSelectAll")).ClientID + "')"); } Source code : Grid :

Date Formats

DATE FORMATS Format # Query (current date: 12/30/2006) Sample 1 select convert(varchar, getdate(), 1) 12/30/06 2 select convert(varchar, getdate(), 2) 06.12.30 3 select convert(varchar, getdate(), 3) 30/12/06 4 select convert(varchar, getdate(), 4) 30.12.06 5 select convert(varchar, getdate(), 5) 30-12-06 6 select convert(varchar, getdate(), 6) 30 Dec 06 7 select convert(varchar, getdate(), 7) Dec 30, 06 10 select convert(varchar, getdate(), 10) 12-30-06 11 select convert(varchar, getdate(), 11) 06/12/30 101 select convert(varchar, getdate(), 101) 12/30/2006 102 select convert(varchar, getdate(), 102) 2006.12.30 103 select convert(varchar, getdate(), 103) 30/12/2006 104 select convert(varchar, getdate(), 104) 30.12.2006 105 select convert(varchar, getdate(), 105) 30-12-2006 106 select convert(varchar, getdate(), 106) 30 Dec 2006 107 select convert(varchar, getdate(), 107) Dec 30, 2006 110 select convert(varchar, getdate(), 110) 12-30-2006 111 select convert(varchar, getdate(), 111) 200...

NameSpace!

Httppost---using System.Web; configuration File----using System.Configuration; ImageFormat-using System.Drawing.Imaging; bitmap--System.Drawing ListItem--using System.Web.UI.WebControls Mail--using System.Net.Mail; stream----System.IO uploadedfile---using Telerik.WebControls;

URL Rewritting

http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/ http://msdn.microsoft.com/en-us/library/ms972974.aspx URL Rewriting in ASP.NET Summary: Examines how to perform dynamic URL rewriting with Microsoft ASP.NET. URL rewriting is the process of intercepting an incoming Web request and automatically redirecting it to a different URL. Discusses the various techniques for implementing URL rewriting, and examines real-world scenarios of URL rewriting. (31 printed pages) Download the source code for this article. Contents Introduction Common Uses of URL Rewriting What Happens When a Request Reaches IIS Implementing URL Rewriting Building a URL Rewriting Engine Performing Simple URL Rewriting with the URL Rewriting Engine Creating Truly "Hackable" URLs Conclusion Related Books Introduction Take a moment to look at some of the URLs on your website. Do you find URLs like http://yoursite.com/info/dispEmployeeInfo.aspx?EmpID=459-099&type=summ...

Indexes in Sqlserver!

Relational databases like SQL Server use indexes to find data quickly when a query is processed. Creating and removing indexes from a database schema will rarely result in changes to an application's code; indexes operate 'behind the scenes' in support of the database engine. However, creating the proper index can drastically increase the performance of an application. The SQL Server engine uses an index in much the same way a reader uses a book index. For example, one way to find all references to INSERT statements in a SQL book would be to begin on page one and scan each page of the book. We could mark each time we find the word INSERT until we reach the end of the book. This approach is pretty time consuming and laborious. Alternately, we can also use the index in the back of the book to find a page number for each occurrence of the INSERT statements. This approach produces the same results as above, but with tremendous savings in time. When a SQL Server has no index to ...

Web.config

Ruben Heetebrij Ruben is a senior software engineer and team manager for Capgemini in the Netherlands. He is specialized in Web development and Visual Basic applications. Ruben Heetebrij has written 3 articles for SitePoint with an average reader rating of 8.5. View all articles by Ruben Heetebrij... The ASP.NET Web.config File Demystified By Ruben Heetebrij January 6th 2005 Reader Rating: 8.5 Applications of XML have been integrated into .NET to such an extent that XML is hardly a buzzword anymore. Microsoft, as you probably know, has taken XML into the core of its .NET framework. Not only is XML a generally accepted format for the exchange of data, it's also used to store configuration settings. Configuration settings for any of your ASP.NET Web applications can be stored in a simple text file. Presented in an easily understandable XML format, this file, called Web.config, can contain application-wide data such as database connection strings, custom error messages, and culture s...