Thursday, April 26, 2007

Get selected node from IE web controlTreeview WebControl-ASP.NET

I have search lots of pages for this but i have not found then i have tried lots of way then after that i found this amazing code.

It is very easy and simple....

tv.GetNodeFromIndex(tv.SelectedNodeIndex).Text.ToString()

here tv is name of the tree view

Share:

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 ='','',ROWTERMINATOR=''\n'')'
EXEC(@sql)

DECLARE cursor_Country CURSOR READ_ONLY FOR
select [CountryName] from #tmpCountry

OPEN cursor_Country
FETCH NEXT FROM cursor_Country INTO @CountryName
WHILE @@FETCH_STATUS=0
BEGIN
SELECT @id=isnull(max(Countryid),0) from tblCountryMaster
SET @id=@id+1
INSERT INTO tblCountryMaster values(@Id,@CountryName)
FETCH NEXT FROM cursor_Country INTO @CountryName
END
CLOSE cursor_Country
DEALLOCATE cursor_Country
END--PROCEDURE


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

happy programming
Share:
Wednesday, April 25, 2007

How to create search engine in ASP.NET Search PDF,HTML,

I have found a great article to create search engine in asp.net. It describes every aspect of search engine and also explain how to build search engine. It not only searches html it also searches pdf files, word,power point files and other things.

here is the link for that article...
Share:

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...
Share:

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.
Share:
Tuesday, April 24, 2007

Mouse Over -Mouse Out effect in gridview of asp.net

I have found to great article to give mouse hover and mouse out effect on grid view.

here is the link to this articles
Share:

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...
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews