Skip to main content

Posts

Showing posts from April, 2007

Bulk insert with dynamic primary key -SQL Server 2000/2005

You often need a bulk insert with dynamic primary key where you can define your keys without getting it from the .txt files or .csv files.

here are the stored procedure to bulk insert country with dynamic primary key.

first create temp.txt file in c drive with following data.

Australia
Canada
America
India

then create table with following fields

countryid int 4
countryname varchar(100)

and assign name as tblCountryMaster

now use following stored procedure


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE sp_BulkInsertCountry
(
@FilePath varchar(1000)
)
AS
BEGIN--PROCEDURE
--variable declaration
declare @SQL varchar(500)
declare @id int
declare @CountryName varchar(30)


--Create temporary table for Country
CREATE TABLE #tmpCountry
(
CountryName varchar(30),
)

---executing bulk insert on temporary table
SET @SQL='BULK INSERT #tmpCountry from ''' + @FilePath + ''' WITH (FIELDTERMINATOR ='','',ROWTERMINATO…

Saving line break in multiline textbox ASP.NET 1.1

Many time it happens with the multi line text box that it does not save the line break and another things in the text box. I have found a great way to do this..

You can replace the line break with the string replace function for example your text box name

if you want to assign text box to a some value...
txtAddress.Text=objAddress.CompanyAddress.Replace("put here br","\r\n");

if you want to assign text box value to another object
txtAddress.Text=objAddress.CompanyAddress.Replace("put here br","\r\n");

happy programming...

applying CSS in multiline textbox of asp.net

I have seen many time whenever we try to apply css classes to the the multi line text of asp.net. It does not work.

It may happened due to the browser treat that text box as the text area. So you can do it with defining text area element in css and it will automatically apply to the multi line text box.

For example.
text area
{
border:#CCCCCC 1px solid;
font-size:10px;
vertical-align:middle;
}

If still it is not working that you can set directly attributes with property such as font,font size etc.

ASP.NET WEB IE CONTORLS TAB STRIP,TREE VIEW FOR asp.net 1.1

We often need to create tree view and tab strip controls in web application. Microsoft is not providing all the control with the .NET Framework. So we have to create it own or we have to third party controls. But, I have found a great controls developed by msdn people which contains tab strip,tree view, multi page controls.

here is the link to download controls...

53 CSS-Techniques You Couldn’t Live Without

Cascading Style sheet are used by more and more web developers today. CSS has many advantages over the simple html. It is compact and can be used as general resource for all the web pages.

I have found a great article which has 53 ideas for CSS and you can't ignore them. Let’s take a look at 53 CSS-based techniques you should always have ready to hand if you develop web-sites.

here is the link:
http://www.smashingmagazine.com/2007/01/19/53-css-techniques-you-couldnt-live-without/

Formating date in asp.net1.1 datagrid.

Some time we need to display the dates in data grid. And we have to format it as per the requirement.

here is the way to format link in the data grid.

First Select data grid and open property window by pressing f4. Then go to the.
Click on the property builder then click the columns and select the column which you
want to display in date format.

Then go to the data formating expression text box and paste the following code.
{0:dd/MM/yyyy}

compile the application and now data will be display in dd/MM/yyyy format.

Here you can specify any valid format for date.

How to market your blog

A blog is a great platform to give your opinion and discuss your life with others. If you are a great blogger and you are writing posts about everything but nobody is visiting your blog then it is worthless. So you have to market your blog.

There is lots of way to market your blog. I have found a great link for marketing your blog.

here is the link:
http://www.problogger.net/archives/2007/01/11/how-to-market-your-blog-in-2007/

Microsoft Anti-Cross Site Scripting Library version 1.5

Microsoft has launched anti scripting library to secure your website from cross scripting.

The Anti-Cross Site Scripting Library can be used to provide a high degree of protection to Web-based applications against Cross-Site Scripting (XSS) attacks.


http://www.microsoft.com/downloads/details.aspx?familyid=efb9c819-53ff-4f82-bfaf-e11625130c25&displaylang=en

How hackers hack the ajax enabled site. + Stop Hacking

Have you ever think about the securing your ajax enabled websites? Hacker use XSS vulnerabilities to hack this kind of site.

I have found great link that deeply discuss the this XSS vulnerabilities. Mike Ormond has deeply explained about stopping hackers to hack your asp.net Ajax enabled website.

here is the link

http://blogs.msdn.com/mikeormond/archive/2007/04/04/hacking-ajax-applications.aspx

ASP.NET 1.1-Document Outline Window

If you are using visual studio.net 2003 and you are finding some html code or you want to see the html code for the particular source then document outline window will help you.

It provides the complete tree structure of a html code. So you can easily navigate through it and by selecting particular node will directly moves cursor to that control related code in html pane.

It is a very useful tool navigate between elements of a page or control.

You can see this windows by pressing Ctrl+Alt+ T or you can go through view->Other window -> Document Outline

Here is the screen shot for document outline window.

Ajax control toolkit for ASP.NET 1.1,2.0 -ANTHEM.NET

There are lots of Ajax enable toolkit available to asp.net 2.0 but i have found another one Ajax enable toolkit. It is Jason Diamond's MyAjax.net which has recently been redesigned and launched on SourceForge.Net as Anthem.NET.


Anthem.net is so easy to use and contain almost all the controls are Ajax Enabled.It supports view state, so you can get control states and page info back in callbacks. It works seamlessly with web user controls, and master pages; and having used it on a live application, I can say it's reasonably stable. Best of all, you won't need to write any JavaScript (or XML script).

You can found more details for anthem.net from following links.

http://www.codeproject.com/Ajax/AnthemNET.asp

http://anthem-dot-net.sourceforge.net/

http://anthem-dot-net.sourceforge.net/docs/

http://anthem.talloaksoftware.com/

ASP.NET ACESS KEY PROPERTY-SHORT KEY FOR FOCUS

In the desktop windows application. You can easily create short key which moves current cursor to a particular control. Now with ASP.NET Access key property you can also create short key in
web application.

For example you have a text box called txtName write name of the candidate. So go the property window by pressing f4. And goto access key property and write N . That's it you have created a short cut key for the that text box.

Compile the source and code and view the page in a browser. Now you can set focus on txtname text box via pressing ALT+N.

Happy Programming....




Hot keys in ASP.NET Page

Shortcut key is esesntial features in the desktop applicaitons. Without shortkey we cant even think of desktop application.

Have you think of a shortkey in web application. Yes, it is possible to define the shortcut key for a button. (I am not kidding). I have found a very good article on how to define hotkeys with the help of javascript by M. Vadivel.

He has explained a great way to define hotkey on a page that will trigger a action when this hotkeys are pressed such as ALT + S.

here is the link for that article...

http://www.15seconds.com/howto/pg000086.htm

Microsoft ASP.NET 1.1 Starter Kits...

ASP.NET 2.0 is one of the most hottest plateform in the web developement but still lots of people are using asp.net 1.1 and it is quite popular among the developers.

Those who want to learn asp.net the asp.net 1.0/1.1 are first step.

Here are the some start kits provided by microsoft for asp.net 1.1. It still available

here is the link...
http://www.asp.net/downloads/default11.aspx?tabid=62

Microsoft Automotive- A Fremework and Plateform for Automotive Industries

Microsoft Automotive is one of the greatest step of microsoft towards the automobile industries..

Microsoft works in collaboration with its innovative partners to deliver comprehensive value and new capabilities to the automotive industry, providing insight and innovation for the creation, marketing, and enjoyment of the automobile.

Micorsoft has also created microsoft automative & industrial solutions group to accelerate developement in automotive industries using microsoft technologies.

For more details read following link:

Microsoft Automotive