Pages

About Me

My photo
ForEach(Minute in MyLife) MyExperience ++;

Tuesday, December 20, 2011

MS word Automation

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using Microsoft.Office; 
using Microsoft.Office.Interop.Word; 
using Word = Microsoft.Office.Interop.Word; 
namespace CreditRequest 
    public partial class CreditRequest : Form 
    { 
        int iTotalFields = 0; 
        public CreditRequest() 
        { 
            InitializeComponent(); 
        } 
        private void btn_Generate_Click(object sender, EventArgs e) 
        { 
            Object oMissing = System.Reflection.Missing.Value; 
            Object oTrue = true
            Object oFalse = false
            Word.Application oWord = new Word.Application(); 
            Word.Document oWordDoc = new Word.Document(); 
            oWord.Visible = true
            Object oTemplatePath = "C:\\Template.dot"
            oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing); 
            foreach (Word.Field myMergeField in oWordDoc.Fields) 
            { 
                iTotalFields++; 
                Word.Range rngFieldCode = myMergeField.Code; 
                String fieldText = rngFieldCode.Text; 
                if (fieldText.StartsWith(" MERGEFIELD")) 
                { 
                    Int32 endMerge = fieldText.IndexOf("\\"); 
                    Int32 fieldNameLength = fieldText.Length - endMerge; 
                    String fieldName = fieldText.Substring(11, endMerge - 11); 
                    fieldName = fieldName.Trim(); 
                    if (fieldName == "Name"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(txt_CustName.Text); 
                    } 
                    if (fieldName == "Date"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(dtp_CreditDate.Text); 
                    } 
                    if (fieldName == "Country"
                    { 
                        myMergeField.Select(); 
                        oWord.Selection.TypeText(txt_DestCountry.Text); 
                    } 

                } 
            } 
        } 
    } 
} Refer : http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/1a100644-da0f-482c-8042-339a8ff1658a

Monday, November 14, 2011

Pass Values Between ASP.NET Web Pages

There are mainly five ways to pass values between asp.net web pages ...
1.By using query string.
2. Using HTTP POST
3. Using Session
4. Using Public properties
5.Using control information of controls

.... ( Detail reading )

Thursday, November 10, 2011

Import data from Excel sheet to SQL server using .Net

.Net Interview Questions for experienced Candidates

Wednesday, October 26, 2011

What is Visual Studio LightSwitch?


What is Visual Studio LightSwitch?
Microsoft Visual Studio LightSwitch is a simplified self-service development tool that enables you to build business applications quickly and easily for the desktop and cloud. What can your business do with LightSwitch? Watch this brief introduction to find out. .. (-- more --)

Free E-book , moving to visual studio 2010

http://blogs.msdn.com/b/microsoft_press/archive/2010/09/13/free-ebook-moving-to-microsoft-visual-studio-2010.aspx

Visual Studio's collection of books

Visual Studio's collection of books span across all versions and editions of the products. In many cases, the information contained within are applicable to whichever version and/or edition you are using. Click here

Security Development Lifecycle Process Template for VSTS 2008


Overview

MSF-A+SDL is a TFS process template that incorporates the Security Development Lifecycle (SDL) for Agile process guidance into the MSF Agile development framework. With the MSF-A+SDL template, any code checked into the Visual Studio Team System source repository by the developer is analyzed to ensure that it complies with SDL secure development practices. The template also automatically creates security workflow tracking items for manual SDL processes such as threat modeling to ensure that these important security activities are not accidentally skipped or forgotten...... for more details click here



Thursday, August 11, 2011

Great Free Video Training on ASP.NET Web Forms and ASP.NET MVC

                            Created by Pluralsight (a great .NET training company), these video courses are available free of charge and provide a great way to learn (or brush-up your knowledge of) ASP.NET Web Forms 4 and ASP.NET MVC 3.  Each course is taught by a single trainer, and provides a nice end-to-end curriculum (from basic concepts to working with the new Entity Framework “code first” model to security, deployment, and testing).  

Enter the link

Saturday, July 30, 2011

Regular expression library

http://regexlib.com/%28X%281%29A%28veT2YrYs6oiekXsLokG37Fc2mfxjYmViaR4eW0zuOEP1CBjGIgwDHLXIrg1zhhwk6_erWPt6NjWtU1-6PeLbawT5VfFqS2SmYao_lf6LjPAwFXUojZs13Y9NoHPphmf4isJf_uCicvYjRUCHuaNJ294Hc8v0W-xQaZncUlLzwRtIOMLCzSnXYjE7nlvK5NTD0%29%29/DisplayPatterns.aspx

Thursday, July 28, 2011

Popup window using javascript

<script language="javascript" type="text/javascript">

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
if(pos=="random"){LeftPosition=(screen.width)?
Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor
(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?
(screen.width-w)/2:100;TopPosition=(screen.height)
?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+
TopPosition+',left='+LeftPosition+',scrollbars='
+scroll+',location=no,directories=no,status
=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
</script>
Copy the following where you want to generate popup link
<a href="http://www.google.com" 
onclick="NewWindow(this.href,'mywin',
'120','120','no','center');return false" 
onfocus="this.blur()">YourLinkText</a>

Disable back key in browser

Add this script inside head tag in html page 

<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script

Cross Browser HTML and CSS Compatibility

If you follow XHTML and CSS standards according to the XHTML and CSS version then no need to worry about the browser compatibility ..




Check your pages whether it follow using ,


http://validator.w3.org/
http://jigsaw.w3.org/css-validator/
http://www.w3.org/QA/Tools/

Wednesday, July 27, 2011

Disable Enter Key

<script language=javascript type=text/javascript>

function stopRKey(evt) {
   var evt = (evt) ? evt : ((event) ? event : null);
   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
   if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}

document.onkeypress = stopRKey;

</script>

How browsers understand ASP.NET or PHP pages?

How browsers understand ASP.NET or PHP pages?

If visit any web site, no matter what technology is used to develop the site, your browser will be able to display the page for you. The only thing a browser can understand is "HTML". It does not know ASP.NET or PHP. So, even if your web site is developed using ASP.NET, still your browser can understand only HTML.

This is how it works:

You type a URL in your browser. (Eg: http://www.xyz/asp.net/lesson1.aspx)
Your browser will compose a request for this page and send to the web server in
internet. The web server analyzes the request and it understands that the request is for an ASP.NET page called "lesson1.aspx". So, the web server hand over the request to the aspnet service running as part of the web server. (If the page is a .php file,then there must be a php service running on the webserver).The aspnet service loads the page "lession1.aspx". Inside this page, we have written code to read the TutorialId passed as a parameter (parameters are called "Query String"). Our code gets this tutorial id and then retrieves the corresponding content from the database. Then our code embeds this content into the page and returns the dynamically modified page content to the web server. Web server returns the dynamically generated page to the browser. This dynamically generated page has only HTML in it, even though this html came from database. When the browser receives the page, it has only HTML. So, as far as a browser is concerned, it does not care what type of web site it is. It can be any technology like ASP.NET or PHP. It is the responsibility of the web server to generate dynamic content from database or wherever and give only HTML page content to the browser.

Pop a banner each time Windows Boots

To pop a banner which can contain any message you want to display just before a user is going to log on, go to the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WinLogon Now create a new string Value in the right pane named LegalNoticeCaption and enter the value that you want to see in the Menu Bar. Now create yet another new string value and name it: LegalNoticeText. Modify it and insert the message you want to display each time Windows boots. This can be effectively used to display the company's private policy each time the user logs on to his NT box. It's .reg file would be: REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon] "LegalNoticeCaption"="Caption here."

Clear all controls in a webform

private void Clear(Control Parent)
{
foreach (Control Child in Parent.Controls)
{
if (Child.HasControls())
Clear(Child);
else
{
if (Child.GetType() == typeof(TextBox))
((TextBox)Child).Text = "";
}
}
}
protected void Button1_Click(object sender, EventArgs e)

{

Clear(this.Page);
}
} 

Export only selected values

http://www.aspsnippets.com/Articles/ASP.Net-GridView-Export-only-selected-columns-to-Excel-Sheet.aspx

Auto complete textbox in asp.net

http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx

Implementing Spelling Check Feature using TinyMCE Rich Text Editor in ASP.Net

Check username availability in .Net

http://www.aspsnippets.com/Articles/Check-Username-Availability-in-ASP.Net-using-AJAX-PageMethods.aspx

Tuesday, July 26, 2011

Fixed header gridview

http://www.aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-using-jQuery-Plugin.aspx

.Net Document Viewer

http://www.aspsnippets.com/Articles/Display-Word-document-on-web-page-in-ASP.Net.aspx

Validate File types

http://www.aspsnippets.com/Articles/jQuery-Plugin-to-validate-File-Types-and-Extensions-in-ASP.Net-AsyncFileUpload-Control.aspx

Formatted Emails

Send format emails using asp.net   :

http://www.aspsnippets.com/Articles/Create-and-send-HTML-Formatted-Emails-in-ASP.Net-using-C-and-VB.Net.aspx

Image preview after upload

http://www.aspsnippets.com/Articles/Display-image-after-upload-without-page-refresh-or-postback-using-ASP.Net-AsyncFileUpload-Control.aspx

Rich textbox editor in asp.net

http://www.aspsnippets.com/Articles/Using-Tiny-MCE-Rich-TextBox-in-ASP.Net.aspx

Multiple File hosting using ASP.Net and jQuery

http://www.aspsnippets.com/Green/Articles/Multiple-File-Uploads-Gmail-Style-using-JQuery-and-ASP.Net.aspx

Format date time

String.Format("{0:dd MMM yyyy }", Convert.ToDateTime(your value in datetime format));

Automatic redirection of pages after few seconds

 HtmlMeta meta = new HtmlMeta();
                meta.HttpEquiv = "Refresh";
                meta.Content = "3; URL=Default2.aspx";
                Page.Header.Controls.Add(meta);

Get Referrer URL

Get the details of your referrer , ie, from where the user gets redirected to your page ....


_REFUrl = Request.URLReferrer.Host.ToString

Friday, July 22, 2011

C sharp code optimization techniques

Reference : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/highperfmanagedapps.asp

Thursday, July 21, 2011

Passing multiple arguments in c#

.aspx page ,

"<asp:imagebutton com="" commandargument="&lt;%#Eval(&quot;ERROR_FILE1&quot;) + &quot;,&quot;+Eval(&quot;ERROR_FILE2&quot;)+&quot;,&quot;+Eval(&quot;ERROR_FILE3&quot;)%&gt;" commandname="&lt;%# Eval(&quot;ERROR_ID&quot;) %&gt;" id="ImgB_DELETE" imageurl="../images/Manager/trash.png" onclientclick="return confirm('Are you sure you want to delete this Error Report?')" oncommand="Delete" runat="server"></asp:imagebutton>"

.cs page

 string[] Argument = e.CommandArgument.ToString().Split(new char[] { ',' });
        string File1 = Argument[0].ToString();
        string File2 = Argument[1].ToString();
        string File3 = Argument[2].ToString();

Saturday, July 16, 2011

My Career-Blog With Jobs: Applied Development – Walkin for .Net Developer @ ...

My Career-Blog With Jobs: Applied Development – Walkin for .Net Developer @ ...: "Applied Development – Walkin for .Net Developer @ Chennai On 16 July 2011 Position : Dotnet Developer Job Location : Chennai Venue : App..."

"M" 4 Mahi: .Net programmers needed urgently

"M" 4 Mahi: .Net programmers needed urgently: "Position:-.Net Developer Location : Bangalore Education : ANY GRADUATION and PG Exp : 2-3 YRS Salary Offered: 7-8 K during 3-4 months pr..."

.Net programmers needed urgently

Company :impulse technology
Email :
Website : www.impulse-technologies.com
Qualification :Degree
Expeience :1 year
Vaccancy posted :
Tehnology :C#, ASP.Net, SQL Server 2005
Location: Banglore

.Net vaccancies

Candidates with qualifications .BE/ B.Tech./ MCA
2 plus years .

Employer: Reylon soft

post your resume at careers@relyonsoft.com., or visit
http://www.relyonsoft.com/careers/current-openings.php

.Net vaccancies in bangalore

Candidates with qualifications .BE/ B.Tech./ ME/ M.Tech/ MCA/ MSc ,
1-3 Yrs Exp in VB.Net, ASP.Net, ADO.Net & SQL Server needed . Work location is Bangalore.

Employer: Xsys Software Technologies

post your resume at careers@xsyssoftech.com or visit
http://www.xsyssoftwaretechnologies.com

"M" 4 Mahi: Inport your contacts from Other sites

"M" 4 Mahi: Inport your contacts from Other sites: "http://www.plaxo.com/api/widget?src=ab_chooser"

Inport your contacts from Other sites

http://www.plaxo.com/api/widget?src=ab_chooser

Wednesday, July 13, 2011

Monday, July 11, 2011

Default Upload file size is 4 mb

Add this to the web config file and change the file size as u wish

Image save / retrieve/ extension / delete

==================================
image save
==================================

public string Save_Photo = HttpContext.Current.Server.MapPath("~/Upload/User_Photo/");
public string Get_Photo = "~/Upload/User_Photo/";

====================================
image retrieve
====================================
Img_USER_PHOTO.ImageUrl = clas.Get_Photo + dt.Rows[0]["USER_PHOTO"].ToString();


=====================================
Sub string
=====================================

Fup_USER_PHOTO.FileName.Substring(Fup_USER_PHOTO.FileName.LastIndexOf('.'));

====================================
delete image from folder
=====================================
System.IO.File.Delete(HttpContext.Current.Server.MapPath("~/images/") + DropDownList1.SelectedValue);

======================================
File search
=======================================
if (File.Exists(clas.Save_Photo + Photo_Del))
{
File.Delete(clas.Save_Photo + Photo_Del);
}

========================================
File extensions
========================================
if (fu.HasFile) // fu refers to FileUpload control.
{
String fileExtension = System.IO.Path.GetExtension(fu.FileName).ToLower();
String[] allowedExtensions = { ".jpg", ".gif", ".png" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
if (fileOk == true) { fu.SaveAs("path" + fu.FileName); }
}
}

Saturday, July 2, 2011

Change gridview row style dynamically ...

Inside row databound ,
e.Row.Font.Bold = true;

e.Row.Style.Add("color","White");
e.Row.Style.Add("background-color", hf.Value);
e.Row.BackColor = Color.White; ( add namespace system.drawing)


Example :
protected void Gv_NOTICE_LIST_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField HF_Status = (HiddenField)e.Row.FindControl("Hf_NOTICE_STATUS");
ImageButton Delete = (ImageButton)e.Row.FindControl("ImgB_DELETE");
if (HF_Status.Value != "")
{
if (HF_Status.Value == "0")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Unread";
Delete.Enabled = false;
e.Row.Font.Bold = true;
Delete.Attributes.Add ("title", "An unreaded notice cant be delete");

}
else if (HF_Status.Value == "1")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Read";
Delete.Enabled = true;

}

//else if (HF_Status.Value == "2")
//{
// Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
// Lbl_Status.Text = "Deleted";
//}
}
}
}

Tuesday, June 28, 2011

Web Application Testing

Complete guide on testing web applications
1) Functionality Testing
2) Usability testing
3) Interface testing
4) Compatibility testing
5) Performance testing
6) Security testing
1) Functionality Testing:
Test for – all the links in web pages, database connection, forms used in the web pages for submitting or getting information from user, Cookie testing.
Check all the links:
• Test the outgoing links from all the pages from specific domain under test.
• Test all internal links.
• Test links jumping on the same pages.
• Test links used to send the email to admin or other users from web pages.
• Test to check if there are any orphan pages.
• Lastly in link checking, check for broken links in all above-mentioned links.
Test forms in all pages:
Forms are the integral part of any web site. Forms are used to get information from users and to keep interaction with them. So what should be checked on these forms?
• First check all the validations on each field.
• Check for the default values of fields.
• Wrong inputs to the fields in the forms.
• Options to create forms if any, form delete, view or modify the forms.
Let’s take example of the search engine project currently I am working on, In this project we have advertiser and affiliate signup steps. Each sign up step is different but dependent on other steps. So sign up flow should get executed correctly. There are different field validations like email Ids, User financial info validations. All these validations should get checked in manual or automated web testing.
Cookies testing:
Cookies are small files stored on user machine. These are basically used to maintain the session mainly login sessions. Test the application by enabling or disabling the cookies in your browser options. Test if the cookies are encrypted before writing to user machine. If you are testing the session cookies (i.e. cookies expire after the sessions ends) check for login sessions and user stats after session end. Check effect on application security by deleting the cookies. (I will soon write separate article on cookie testing)
Validate your HTML/CSS:
If you are optimizing your site for Search engines then HTML/CSS validation is very important. Mainly validate the site for HTML syntax errors. Check if site is crawlable to different search engines.
Database testing:
Data consistency is very important in web application. Check for data integrity and errors while you edit, delete, modify the forms or do any DB related functionality.
Check if all the database queries are executing correctly, data is retrieved correctly and also updated correctly. More on database testing could be load on DB, we will address this in web load or performance testing below.
2) Usability Testing:
Test for navigation:
Navigation means how the user surfs the web pages, different controls like buttons, boxes or how user using the links on the pages to surf different pages.
Usability testing includes:
Web site should be easy to use. Instructions should be provided clearly. Check if the provided instructions are correct means whether they satisfy purpose.
Main menu should be provided on each page. It should be consistent.
Content checking:
Content should be logical and easy to understand. Check for spelling errors. Use of dark colors annoys users and should not be used in site theme. You can follow some standards that are used for web page and content building. These are common accepted standards like as I mentioned above about annoying colors, fonts, frames etc.
Content should be meaningful. All the anchor text links should be working properly. Images should be placed properly with proper sizes.
These are some basic standards that should be followed in web development. Your task is to validate all for UI testing

Other user information for user help:

Like search option, sitemap, help files etc. Sitemap should be present with all the links in web sites with proper tree view of navigation. Check for all links on the sitemap.
“Search in the site” option will help users to find content pages they are looking for easily and quickly. These are all optional items and if present should be validated.

3) Interface Testing:

The main interfaces are:
Web server and application server interface
Application server and Database server interface.
Check if all the interactions between these servers are executed properly. Errors are handled properly. If database or web server returns any error message for any query by application server then application server should catch and display these error messages appropriately to users. Check what happens if user interrupts any transaction in-between? Check what happens if connection to web server is reset in between?

4) Compatibility Testing:

Compatibility of your web site is very important testing aspect. See which compatibility test to be executed:
• Browser compatibility
• Operating system compatibility
• Mobile browsing
• Printing options
Browser compatibility:
In my web-testing career I have experienced this as most influencing part on web site testing.
Some applications are very dependent on browsers. Different browsers have different configurations and settings that your web page should be compatible with. Your web site coding should be cross browser platform compatible. If you are using java scripts or AJAX calls for UI functionality, performing security checks or validations then give more stress on browser compatibility testing of your web application.
Test web application on different browsers like Internet explorer, Firefox, Netscape navigator, AOL, Safari, Opera browsers with different versions.
OS compatibility:
Some functionality in your web application is may not be compatible with all operating systems. All new technologies used in web development like graphics designs, interface calls like different API’s may not be available in all Operating Systems.
Test your web application on different operating systems like Windows, Unix, MAC, Linux, Solaris with different OS flavors.
Mobile browsing:
This is new technology age. So in future Mobile browsing will rock. Test your web pages on mobile browsers. Compatibility issues may be there on mobile.
Printing options:
If you are giving page-printing options then make sure fonts, page alignment, page graphics getting printed properly. Pages should be fit to paper size or as per the size mentioned in printing option.

5) Performance testing:

Web application should sustain to heavy load. Web performance testing should include:
Web Load Testing
Web Stress Testing
Test application performance on different internet connection speed.
In web load testing test if many users are accessing or requesting the same page. Can system sustain in peak load times? Site should handle many simultaneous user requests, large input data from users, Simultaneous connection to DB, heavy load on specific pages etc.
Stress testing: Generally stress means stretching the system beyond its specification limits. Web stress testing is performed to break the site by giving stress and checked how system reacts to stress and how system recovers from crashes.
Stress is generally given on input fields, login and sign up areas.
In web performance testing web site functionality on different operating systems, different hardware platforms is checked for software, hardware memory leakage errors,

6) Security Testing:

Following are some test cases for web security testing:
• Test by pasting internal url directly into browser address bar without login. Internal pages should not open.
• If you are logged in using username and password and browsing internal pages then try changing url options directly. I.e. If you are checking some publisher site statistics with publisher site ID= 123. Try directly changing the url site ID parameter to different site ID which is not related to logged in user. Access should denied for this user to view others stats.
• Try some invalid inputs in input fields like login username, password, input text boxes. Check the system reaction on all invalid inputs.
• Web directories or files should not be accessible directly unless given download option.
• Test the CAPTCHA for automates scripts logins.
• Test if SSL is used for security measures. If used proper message should get displayed when user switch from non-secure http:// pages to secure https:// pages and vice versa.
• All transactions, error messages, security breach attempts should get logged in log files somewhere on web server.

------ http://www.softwaretestinghelp.com/web-application-testing/

Monday, June 20, 2011

Friday, June 17, 2011

Lenght restriction using validator

Here is the ValidationExpression to set the MaxLength (and also MinLength) of the input string: [^$]{MinLength,MaxLength}

Replace MinLength and MaxLength with numeric values. For example, a 100 character MaxLength with no Minimum length: [^$]{0,100}

Wednesday, June 15, 2011

Basic Test Cases

Test Cases for web applications

1. Execute with null values
a. Check the validators
b. Uniformity of Error Messages
c. Position of Error Messages
d. Check expected Literal Message (Result)
2. Execute with Invalid Values
1. (Date formats ,
2. File formats ,
3. Email format,
4. Alphabets,
5. Numerals ,
6. Alphanumeric Characters ,
7. Character count ,
8. Dropdown list ,
9. Check box ,
10. Radio button Post backs )
a. Check the validator
b. Uniformity Of Error Messages
c. Position Of Error Messages
d. Check expected Literal Message (Result)
3. Execute with Valid Values
a. Check the validator
b. Check Expected Result
c. Page redirections
d. Output Alignment, Date formats, Status, Type ….. formats,
e. Paging , Sorting , Searching functionalities with all possible cases
4. General Appearance
a. Page Titles
b. Naming Conventions
c. Coding Standards
d. Uniformity in appearance
e. Compatibility with CSS classes
f. Validation Groups
g. Uniformity in Page names, Class files, Function names, Variables ...
h. Internal / External Links
i. Appearance and Functionalities in various browsers
5. Database
a. Login Authentication
b. Uniformity in Naming of Tables , Stored Procedures , Views etc
c. Primary Key / Auto increment etc

Monday, June 6, 2011

Redirect page automatically using c#

HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "Refresh";
meta.Content = "3; URL=Emp_Task_List.aspx";
Page.Header.Controls.Add(meta);

3 is the time duration in seconds
URL is d url to where to redirect

Tuesday, May 31, 2011

1. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

2. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

3. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

4. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

5. Where do you store the information about the user’s locale?
CodeBehind is relevant to Visual Studio.NET only.

6. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

7. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

8. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

9. Whats an assembly?
Assemblies are the building blocks of the .NET framework;

10. Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

11. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

12. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

13. Which template must you provide, in order to display data in a Repeater control?

ItemTemplate.
14. Name two properties common in every validation control?

ControlToValidate property and Text property.

15. What base class do all Web Forms inherit from?

The Page class.
16. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address

17. What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.

18. What is the lifespan for items stored in ViewState?

Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

19. What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

20. What are the different types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

Clear All Controls Inside a form

foreach (Control ctrl in this.frm1.Controls)
{
if (ctrl is TextBox)
(ctrl as TextBox).Text="";
}
Or move all TextBoxes into Panel, Panel.Controls.Clear(); will work..

Find Control Inside Gridview

if (e.Row.RowType == DataControlRowType.DataRow)
{
Label Lbl1 = (Label)e.Row.FindControl("Lbl_STATUS");
if (Lbl1.Text == "True")
Lbl1.Text = "Active";
else if (Lbl1.Text == "False")
Lbl1.Text = "Inactive";
}

Thursday, May 19, 2011

“Community of communities” grows up

d Java.net, called as ‘ Community of communities’ is a big umbrella of communities that Can be divided – by bloggers, developers, end users and educators. Have two major components – a forge side and a social side. The forge, accessible via Project t Tab, or by going directly to a project. The social side of Java.net offers a more social presence.
Java.net has been undergoing major changes –switching forge infrastructure and building a stronger CMS to support social and editorial side.Java.net was originally launched by Sun,2003 but as the site grew, more users and traffic made taking the site offline for a few days or weeks to do upgrades.
Now, more refinements in the process and Java.net embrace the raw definition of a “community “– a group of people with a common interest or goal. Java.net can now support new ideas and communities as they arrive, instead of building them out and assuming that people show up, also have more powerful tools for analysis to help showcase the community’s real leader and reward them with privileges and access to tools that will make what they are doing easier...

Blog: java.net/blogfront

Tuesday, May 17, 2011

Loading Year Dynamically inside Drop down List

for (int year = 1990; year <= DateTime.Now.Year; year++)
Ddl_USER_PASSYEAR.Items.Add(new ListItem(year.ToString(), year.ToString()));

Wednesday, May 11, 2011

Validation expressions for Image Format

ValidationExpression="^.*\.((j|J)(p|P)(g|G)|(j|J)(p|P)(e|E)(g|G)|(p|P)(n|N)(g|G)|(g|G)(i|I)|(f|F))$"

Regular validation expression for Mobile Number

Validation expression ="^[0-9]{10}"

Binding Values from db dynamically to dropdown list

dropdownlist binding

drp_Brand.DataSource = ds.Tables[0];
drp_Brand.DataTextField = "Brand";
drp_Brand.DataValueField = "Brand";
drp_Brand.DataBind();

Append a default item to listbox / Dropdown List

1.Append a default item to listbox/dropdown
Lb_Prospect_List.Items.Insert(0, new ListItem("Select"));

Trim Text Inside Gridview

<%#Eval("TASK_DESC").ToString().Substring(0,Math.Min(20,Eval("TASK_DESC").ToString().Length))+"...." %>

We cant trim details from SQL server if it was saved as datatype " Text " , so access as it is and trim inside the grid view

Tuesday, May 10, 2011

Wednesday, May 4, 2011

format datetime

http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm

Trim Values Inside Gridview

<%# Eval("EMP_NAME").ToString().Substring(0,Math.Min(3,Eval("EMP_NAME").ToString().Length))+"..." %>

........this will trim ur values into 3 characters + ...

SQL query to toggle between 0 and 1

UPDATE products SET
in_stock = CASE WHEN in_stock = 1 THEN 0 ELSE 1 END;
Or sometimes the developer tries to accomplish the same thing with an overly complex subquery. We can greatly simplify what we’re trying to do with just this query:

UPDATE products SET in_stock = in_stock ^ 1;

The trick is using the caret (“^”), which is the bitwise XOR operator (MySQL, MS SQL Server) with either a “0? or a “1?. For those of you who’s binary math is a bit rusty, remember:

1 ^ 1 = 0
0 ^ 0 = 0
1 ^ 0 = 1
0 ^ 1 = 1

Tuesday, May 3, 2011

Adding style to a file inside grid view dynamically

Label Task_code = (Label)e.Row.FindControl("Lbl_TASK_CODE");
HiddenField task_details = (HiddenField)e.Row.FindControl("Hf_Task_Details");
string[] words = task_details.Value.Split('/');
string Comments = words[0].ToString();
string Extension = words[1].ToString();
string EDR = words[2].ToString();
if (Comments != "0")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}
if (Extension != "False")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}
if (EDR != "False")
{
Task_code.Text = Task_code.Text + "" + "*" + "";
}

Appending Values with Eval inside grid view

Value='<%# "Clinton" + Eval("TASK_COMSTATUS") + "Gallagher"%>'>

Saturday, April 30, 2011

Tooltip for gridview items


<%# Eval("Task_Duration")%>   From:  <%# Eval("TASK_FDATE","{0:dd-MMM-yyyy hh:mm tt}")%>  

 To:      <%# Eval("TASK_EDATE","{0:dd-MMM-yyyy hh:mm tt}")%>



........ Add style as ....

Format Date

string.Format("{0:MM/dd/yyyy}", FDate);

Book mark links

Stylish dropdown lists ...
http://demos.telerik.com/aspnet-ajax/combobox/examples/default/defaultcs.aspx

Multiline tooltips ...
http://www.texsoft.it/index.php?c=software&m=sw.js.htmltooltip&l=it

javascript tooltips ...
http://www.javascriptkit.com/script/script2/htmltooltip.shtml

Format datetime in SQL server ...
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/

Search Button CSS...
http://www.sohtanaka.com/web-design/examples/search-field/

CSS Library...
http://www.dynamicdrive.com/style/

stylish gridviews ...
http://www.cyberslingers.com/Sandbox/GridView.aspx

Create ur own rounded corner divs ...
http://www.scriptgenerator.net/36/Rounded-corners-CSS-box---Rounded-corner-div/

Validators .. Tips and tricks ...
http://www.dotnetcurry.com/ShowArticle.aspx?ID=121

Send Email using ASP.net ...
http://www.developer.com/net/csharp/article.php/3287361/Using-ASPNET-to-Send-E-MailmdashIncluding-Attachments.htm

Regular Expression Library ...
http://regexlib.com/DisplayPatterns.aspx?cattabindex=2&categoryId=3

Search whether item exists in drop down list

ListItem item1 = Ddl_PROJECT_ID.Items.FindByValue(task.PROJECT_ID);
if (item1 != null)
{
Ddl_PROJECT_ID.Items.FindByValue(task.PROJECT_ID).Selected = true;
}
else
{
Ddl_PROJECT_ID.SelectedIndex = 0;
}
string Format = string.Format("{0:D3}", value to format (Example:8));

Out put : 008

Bind data to a dropdown and Append a default value

Ddl_EMP_ID.DataTextField = "EMP_FNAME";
Ddl_TEMP_ID.DataValueField = "EMP_ID";
Ddl_TEMP_ID.DataSource = dt;
Ddl_TEMP_ID.DataBind();
Ddl_TEMP_ID.Enabled = true;
Ddl_TEMP_ID.Items.Insert(0, new ListItem("Select", "-1"));

css borders

http://www.entheosweb.com/tutorials/css/borders.asp

Monday, March 28, 2011

We are Indians .............

The Question : Prove that (2/10)=2

1. American student : This is out of syllabus!

2. Japanese student-- "This is wrong "

3. Chinese Student -- it is strange, How it is possible

4. Indian Student: "It's so Easy!"

(2/10)
=Two/Ten
'T' is common, hence = wo/en
Now,
'W' is the 23rd letter and 'O' is 15th;
Similarly,
'E' is 5th, and 'N' is 14th.

Hence (wo/en) = (23+15)/(5+14)
=(38/19)
=2

Indians never worried for the
"What is the answer."

They will only ask:

"Which answer you want..."

"THAT IS INDIANS !"