February 2010

Upload images in FCKEDITOR in asp.net

1) Create a folder in root namely ” userfiles ” and inside it create sub folder ” image “. So its like this
userfiles \ image

2) Now edit the following lines in fckeditor\fckconfig.js file

var _FileBrowserLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py

Change it to following :-

var _FileBrowserLanguage = ‘aspx’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘aspx’ ; // asp | aspx | cfm | lasso | perl | php | py

3) Now edit the following lines in fckeditor\editor\filemanager\connectors\aspx\config.ascx

// URL path to user files.

UserFilesPath = “/userfiles/”;

Change to :-

UserFilesPath = “~/userfiles/”;

Now you are ready to use fckeditor.
Note :- That is for development on localhost. On remote sever don’t forget to give read/write permission to this userfiles and image folder.

SQL split function

DECLARE @str as varchar(max)
SET @str = ‘Prakash,Sanket,Jigar,JD’
SELECT value as GiveColumName from dbo.split(@str,’,’)

Split function used to insert to multiple records into tables…. see below procedure

INSERT INTO BoqThermoDrawing
SELECT @BoqNo,@RevisionNo,@RootPath+’\’+value from dbo.Split(@FileNames,’/’)

—————————————————————–
Create function in sql server… split after that u can use above function

USE [DataBaseName]
GO
/****** Object: UserDefinedFunction [dbo].[Split] Script Date: 03/04/2010 11:55:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER function [dbo].[Split](
@String nvarchar (4000),
@Delimiter nvarchar (10)
)
returns @ValueTable table ([ID] int,[Value] nvarchar(4000))
begin
declare @NextString nvarchar(4000)
declare @Pos int
declare @NextPos int
declare @CommaCheck nvarchar(1)

–Initialize
set @NextString = ”
set @CommaCheck = right(@String,1)

–Check for trailing Comma, if not exists, INSERT
–if (@CommaCheck @Delimiter )
set @String = @String + @Delimiter

–Get position of first Comma
set @Pos = charindex(@Delimiter,@String)
set @NextPos = 1

–Loop while there is still a comma in the String of levels
Declare @sr as int
set @sr =0
while (@pos 0)
begin
set @NextString = substring(@String,1,@Pos – 1)
set @sr = @sr + 1
insert into @ValueTable ([id], [Value]) Values (@sr , @NextString)

set @String = substring(@String,@pos +1,len(@String))

set @NextPos = @Pos
set @pos = charindex(@Delimiter,@String)
end

return
end

Open Aspx Page in Popup

Add this function in Search Page or View All items page..

function ShowPopUp(Id)
{
$get(”).src=”AssignTool.aspx?ID=”+Id;
$find(”).show();
document.getElementById(“”).innerHTML = “Assign Tool”;
return false;
}

—————– View All Items page ———–

 

——————— view All cs page coding —————

Gridview Row DataBound Event

if (e.Row.RowType == DataControlRowType.DataRow)
{
Button btnAccept = (Button)e.Row.Cells[16].Controls[0];
btnAccept.Attributes.Add(“onclick”, “return ShowPopUpAccept(” + rowView[“AssignToolId”].ToString() + “)”);
}