Sunday, October 25, 2009

Open a New Window On Server Side using Javascript Code in Asp.net

· 1 comments

// open new window with specified path

function OpenWindow(url)

{
newwindow = window.open(url, 'mywindow', 'width=500,height=400');

}

Now In .aspx.cs page or server side to use the javascript window open you have to use the following code

StringBuilder popupScript = new StringBuilder();
popupScript.Append("");
// if you are using script manager - update panel then this
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "PopupScript", popupScript.ToString(), false);
//else
Page.RegisterStartupScript("PopupScript", popupScript.ToString());

Read More......

Saturday, October 24, 2009

Add "Select" Option To Dropdown list in Asp.net

· 0 comments

There are many ways to add select option to dropdown list.. Here in this post i will list some of the ways: 1) Select 2) ddltemp.Items.Add(new ListItem(”Select”, “0")); 3) ddltemp.Items.Insert(0, new ListItem(”Select”, “0")); 4) ddltemp.Items.Insert(0, "--Select--"); ddltemp.Items[0].Value = "0";

Read More......

Friday, September 11, 2009

Tutorial using MySQL with Asp.Net

· 0 comments

If you want to use MySQL Database with Asp.net, then here is a link which explains: http://www.15seconds.com/issue/050407.htm

  • Download of MySQL Server
  • MySQL Administrator
  • MySQL Query Browser
  • .Net Connector (For Asp.net Integration)
The above link has explained in detail, with proper screenshots, from where to download installers, how to install with step by step screens and explanations, and also how to create sample asp.net application with MySQL database, create MySQL database (schema), create MySQL Table, Insert Data, and populate that data in asp.net gridview.

Read More......

Wednesday, September 9, 2009

Using String.Format("{0}", "formatting string"}; in Asp.net

· 0 comments

Many times we want to define formats for date, currency, number etc

For example if we want date in

" 09 September 2009"  - String.Format{0:D}

" 09 September 2009 12:30"  - String.Format{0:f}

Like this various formats for date, month, year, time, currency number etc can be seen at :

http://bit.ly/cctp


Read More......

Tuesday, September 1, 2009

Inserting Data Into Table Using Select Query

· 0 comments

In SQL, sometimes we need to select some data from one table and insert data into another table, this can be done as follows with a simple sql query:

Insert into Table1 (c1, c2, c3, c4, c5)
(Select c1, c2, c3, c4, c5 from Table2)

But make sure that both the tables have same fields, data type..



Read More......

Monday, August 31, 2009

Textbox Watermark using Ajaxtoolkit or By Javascript

· 0 comments

Adding Watermark to textbox can be done in two ways:

1) Using Ajax Toolkit:

<asp:TextBox runat="server" id="txtname"/>
<ajaxToolkit:TextBoxWatermarkExtender ID="TBWE2" runat="server"
TargetControlID="TextBox1"
WatermarkText="Type First Name Here"
WatermarkCssClass="watermarked" />

For more information on Ajax Toolkit please visit:
http://www.asp.net/ajax/

2) Using Javascript
:

<asp:TextBox ID=”txtname” runat=”server” Text = “Please Enter your Name here”
onblur = “TextboxWaterMark(this, event);”
onfocus = “TextboxWaterMark(this, event);”>
</asp:TextBox>

<script type = “text/javascript”>
var Text = “Please Enter your text here”;//black

function TextboxWaterMark(txtid, evnt)
{
if(txtid.value.length == 0 && evnt.type == “blur”)
{
txtid.style.color = “set the color you want”;//red
txtid.value = Text;
}
if(txtid.value == Text && evnt.type == “focus”)
{
txtid.style.color = “set the color you want”;
txtid.value=”";
}
}
</script>

To use in code behind :

txtname.Attributes.Add(”onblur”, “TextboxWaterMark(this, event);”);

txtname.Attributes.Add(”onfocus”, “TextboxWaterMark(this, event);”);

Read More......

Friday, August 28, 2009

Disable button after submit in Asp.net

· 0 comments

Once the user has filled the form details, or did any kind of changes and clicked on submit button, if we want to prevent the duplicate data entry and show other message like "please wait.."'then we can do this as below:

<asp:Button  runat="server" ID="btnsubmit" Text="Submit"
OnClick="btnsubmit_Click" UseSubmitBehavior="false"
OnClientClick="this.disabled=true;this.value='Please wait..';" />

For <asp:imagebutton> usesubmitbehavior will not work hence for this:

<asp:ImageButton runat=”server” ID=”btImageButton”
ImageUrl=”/images/submit.jpeg” OnClick=”btImageButton_Click”
OnClientClick=”javascript: Submit(this);” />

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

function Submit(c){
Page_ClientValidate();
if (Page_IsValid){
c.disabled = true
__doPostBack(c.name, ”);
}
return Page_IsValid;
}

</script>


For furhter reference please visit msdn : http://bit.ly/1CpMBq

Read More......

Wednesday, August 26, 2009

Preview/Show Uploaded Image in Asp.net

· 0 comments

Sometimes, we want to give the preview of the image uploaded through file upload control in asp.net, at the same time.

There is a very nice article on this.. using server side.

http://dotnetspider.com/resources/31341-Show-Uploaded-Image-Image-Control-Asp-net.aspx

In this article, we have one image control, one file upload control and one button control

We upload image using file upload control, and then click on upload button, at the same time the image uploaded will be shown in the image control..

Read More......

Tuesday, August 25, 2009

Getting Last Modified/Created Table, Stored Procedure, Function.. in Sql Server

· 1 comments

Sometimes, we want to know how many tables, stored procedures or functions we have created on a particular day, or on which tables, sps or functions, modifications have occured. All this can be known through a very simple sql query, which is as below:

select name,type,type_desc, create_date, modify_date from sys.objects

where convert(varchar,modify_date,101) = convert(varchar,getdate(),101)

order by modify_date desc

Here

name : - "Its the table or sp or function name"

type: - "To identify a table or sp or function etc.. P, S, U"

type_desc: -"Description whether it is table, sp etc.."

- S = System Table, PK = Primary Key,U = User Table,

- P= Stored Procedure, TF = Table Value Function,

- FN = Scalar Function, D= Default Constraint

create_date: - "Date when it is created"

modify_date: - "Last modified datetime of table, sp,.. etc"

In above query, in place of getdate(), you can pass the date you want, also you can get complete list after removing where condition, just giving order by modified date from sys objects..

Very important when we want to generate scripts for particular tables, sps or function for a particular date.

Read More......

Saturday, August 22, 2009

Changing Css Class or Style At Run time dynamically in Asp

· 0 comments

You can add/change css style or add new attributes to current style at runtime, in asp.net code behind.

Lets say you have:

Download

Now if we want to change its class dynamically then in code behind we have to do:

linktemp.Attributes.Add(”class”, “verdana13greynormalitalic”);

if we want to change its text-decoration under style then,

linktemp.Style.Add(”text-decoration”, “none”);

in the similar you can add new styles, change visible option to true/false,

linktemp.Style.Add(”display”, “block”);

Read More......

Thursday, August 20, 2009

How to Get Table Structure Using SQL Query

· 0 comments

Sql life made so easy..

See how..

View/Copy, structure of table in sql in just one line query….

select * from tablename where 1<>1

cheers…

Read More......

Limiting the number of records to be displayed in Crystal Report

· 0 comments

You might be working with crystal reports, and so must have a noticed that number of records displayed in crystal report are variable, sometimes, it displays 8, sometimes 10.. and so on according to the data, it sets it accordingly.

But we can handle this scenario i.e we can specify how many records we want the crystal report to display. For this you need to follow the below instructions:

To make it show 10 records per page do the following

1. Open the report in Design View

2. Right click on the Details section and select Section Expert

3. Make sure the Details section is selected in the Section Expert dialog box. Check the box that says “New Page After”

4. Click the formula editor button to the right of the checkbox.

5. Enter the following formula

if Remainder (RecordNumber, 10) = 0 then true else false

6. Click Save and Close and then click OK.

If you run the report it should break after each 10 rows.

Read More......

Wednesday, July 15, 2009

Silverlight: Live Silverlight Toolkit Samples With their Documentation

· 0 comments

Are you Learning Silverlight, then you must get started with silverlight controls.

And for this microsoft provides you with live silverlight toolkit samples.
You can interact with them and learn each and every control at your lease.Along with sample controls, it also has documentation explained for each control.

Below are the live links for Silverlight Toolkit:

http://silverlight.net/samples/sl3/toolkitcontrolsamples/run/default.html

http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm

Documentation Link:


http://msdn.microsoft.com/hi-in/library/cc838158(en-us,VS.95).aspx

Read More......

Monday, June 29, 2009

Flex: Developing a Simple Video Player with

· 0 comments

This tutorial will explain you how to develop a video player in flex by making use of <mx:VideoDisplay>.

It is a very simple and easy to implement, within seconds you will be able to build and play videos.

<mx:VideoDisplay> is a flex component for playing video files.

In the below link, the author has beautifully explained the process with proper description and screenshots.

You can also view the demo and download the source code.

http://www.riacodes.com/flex/basic-video-player-in-flex/

Read More......

Friday, June 26, 2009

CRUD(Create/Insert/Update/Delete) with Asp.net MVC Framework, Linq To Sql (.dbml)

· 0 comments

This article will explain you how to create, read, insert, update, delete operations with asp.net mvc with Linq To Sql (.dbml).

Very nice article who are beginners with asp.net mvc framework.

http://blogs.microsoft.co.il/blogs/bursteg/archive/2009/02/03/create-a-strongly-typed-crud-ui-with-asp-net-mvc-rc.aspx

Read More......

Thursday, June 25, 2009

CRUD(Create/Insert/Update/Delete) with Asp.net MVC Framework, ADO.Net Entity Data Model

· 0 comments

This article will explain you how to create, read, insert, update, delete operations with asp.net mvc with ado.net entity model.


Very nice article who are beginners with asp.net mvc framework.


http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/AuthorContactManager06102009052732AM/AuthorContactManager.aspx

Read More......

Thursday, June 18, 2009

Import Excel Spreadsheet Data into SQL Server Database Table

· 0 comments

There are many ways to import/export excel data into sql server table.


Using SqlBulkCopy Common Method for sql server 2005/2008:


http://davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx


In SqlServer 2005 Using Integration Services


http://www.builderau.com.au/program/sqlserver/soa/How-to-import-an-Excel-file-into-SQL-Server-2005-using-Integration-Services/0,339028455,339285948,00.htm


Using Sql Server 2005 Import and Export Wizard


http://www.databasejournal.com/features/mssql/article.php/3580216/SQL-Server-2005-Import--Export-Wizard.htm


Using Sql Server 2008 Import and Export Wizard


http://dotnetslackers.com/articles/sql/Importing-MS-Excel-data-to-SQL-Server-2008.aspx

Read More......

Wednesday, June 3, 2009

Implementing Search in ASP.NET with Google CustomSearch

· 0 comments

Going to add search functionality for your website... why not let google do this task.. it would be easier and user friendly..

With those who are unaware of Google Custom Search :
"With Google Custom Search, you can harness the power of Google to create a customized search experience for your own website"


  • Include one or more websites, or specific webpages

  • Host the search box and results on your own website

  • Customize the look and feel of the results to match your site


For more info on google custom search click here

So lets see how to implement search in asp.net with google custom search..

Here is the step by step procedure very nicely explained in the below article..

http://dotnetslackers.com/articles/aspnet/Implementing-Search-in-ASP-NET-with-Google-Custom-Search.aspx

Read More......

Tuesday, June 2, 2009

Get Only Date from Datetime in Sql

· 0 comments

Sometimes we need to have only date from datetime field in sql.

There are number of ways to accomplish that:

Suppose we take current date

select getdate()

now to take only date from current date excluding time, we do as follows in various ways:




select DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
select convert(varchar,getdate(),101)
select convert(char(8),getdate(),1)
select cast(cast(getdate() as int) as datetime)
select cast(convert(varchar,getdate(),110) as datetime)

Read More......

Monday, June 1, 2009

Adding eWorld.UI (Excentrics World) Calendar Popup, TimePicker.. etc in Asp.net

· 0 comments

You might be in need of Calendar popup or Time Picker in asp.net. I have being using eworld's calendar popup and time picker control since many years.. and all i can say that they are fantastic fully loaded with various features... No Need of taking a textbox and a calendar control for binding date.. and adding different validations for valid date, past and future date validation... now all that comes in one place just drag and drop one calendar popup control and it will give you access to multiple features..

Also there is no time picker control available in our asp.net toolbox.. i searched a lot over the internet and i found this one..

You can download the eworld ui toolkit from :

http://www.eworldui.net/Download.aspx

Toolkit is available for various .net versions whether it is 1.0, 2.0 or 3.5

Once Downloaded, unzip the rar file and install the given exe..

Also, Once done copy the eWorld.UI.dll and paste it in the bin folder of your web application and then right click the web site and add reference of that dll.

Then In the Visual Studio ->View ->Tool box -> Right Click ->Add Tab -> give Eworld Toolkit (as name) - > Right click ->choose items and browse to the eworld ui dll and once done you will see many contorls under that tab in the tool box..

I have been using

CalendarPopup

Time Picker

RangeValidator

CustomValidator

MaskedTextbox...

there are lots of other controls too which you can try at your lease..

Once done.. you can drag and drop the calendar popup on to the aspx page and you will see:

<ew:CalendarPopup ID="tb_startupdate"
runat="server" ControlDisplay="TextBoxImage" ImageUrl="~/Images/dtpicker.jpeg">
</ew:CalendarPopup>

Read More......

Sunday, May 31, 2009

SQL SERVER – Fix : Management Studio Error : Saving Changes in not permitted. The changes you have made require the following tables to be dropped and

· 0 comments

I encountered problem when modifying table in SQL Server 2008, Once the table is created open the table in SSMS by clicking on the table name and selecting “Design.” Try to include another column to the existing table and click on save (CTRL+S). It will prevent it from saving and will emit the following error in popup.
Saving Changes in not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created

i searched the internet.. i got solution from pinal dave's blog

http://blog.sqlauthority.com/2009/05/18/sql-server-fix-management-studio-error-saving-changes-in-not-permitted-the-changes-you-have-made-require-the-following-tables-to-be-dropped-and-re-created-you-have-either-made-changes-to-a-tab/

Read More......

Download Cheatsheets - .Net, Sql Server, Php, Regular Expressions, CSS, Ajax,Javascript....

· 0 comments

A cheat sheet or crib sheet is a concise set of notes used for quick reference.

You can download cheatsheets of various technologies like:

.Net

Actionscript

Ajax

Javascript

C#

HTML

Sql Server

CSS

JAVA

PHP

Regular Expressions

MySql

Asp/Vbscript

etc..

from

http://www.addedbytes.com/cheat-sheets/

http://www.cheat-sheets.org/

Read More......

Download Ajax Loading Image

· 0 comments

Since all the Ajax interactions happen behind the scenes asynchronously, the user doesn't understand what's going on: sometimes the user doesn't need to know what's going on (like when you are just reloading some data), but when he presses a button he needs to know that he did the right thing and that something is happening.

So we can show an "ajax loading image" when ajax process is going on..

You can generate these images from:

http://www.ajaxload.info/

You can also download from:

http://mentalized.net/activity-indicators/

Also you can search the google for ajax loading image and you will be able to see lots of images..

Read More......

Validating Extension(eg. (.aspx/.html/.jpeg....) in asp.net using Regular Expression

· 0 comments

When you want to validate that the text entered must have particular extension that you have decided.

for example if you have a textbox to enter page name. You want the user to enter page name with ".aspx" extension. Then you have to use the following regular expression validator.
<asp:RegularExpressionValidator ErrorMessage=" Please Enter page name with .aspx extension"
ID="RegularExpressionValidator1" runat="server"
ValidationExpression="^.*\.(aspx)$" ControlToValidate="txturl" Display="Dynamic" ></asp:
RegularExpressionValidator >

so now if the user enters "hello.abc" then validation will fire with message "Please enter page name with .aspx extension"

Thus with this ValidationExpression="^.*\.(aspx)$"

you can specify any extension like gif, jpeg or whatever you want..

^.*\.(exe|bat|etc)$





Read More......

Set meta tag in asp.net programmaticaly for seo friendly websites

· 0 comments

When you are developing SEO friendly websites, the first basic thing for seo is meta tags, as all search engines are looking for these meta tags while querying the database. Here we will allow the user to set the "keywords" and "description" (the two parts of meta tag)and then set the meta tag programmatically.

This is how meta tags are set dynamically:

HtmlMeta mKey = new HtmlMeta();
mKey.Name = "keywords";
mKey.Content = "home, blog";
this.Page.Header.Controls.Add(mKey);


HtmlMeta mdesc = new HtmlMeta();
mdesc.Name = "description";
mdesc.Content ="home page";
this.Page.Header.Controls.Add(mdesc);


after doing that you can view in the "View Source" of the page you have set meta tags under the head section.
<meta name="keywords" content="home,blog" />
<meta name="description" content="home page" />

Read More......

Read/Acess globalization section of system.web from web.config

· 0 comments

To read web.config, and find any section there are number of solutions available, one such method to access globalization section which is under system.web of web.config is as follows:

In web.config i have

<globalization uiCulture="nl-NL" />

Now to read the uiculture in codebehind file in asp.net

string uicul = ((System.Web.Configuration.GlobalizationSection)(System.Configuration.ConfigurationSettings.GetConfig("system.web/globalization"))).UICulture;


Lets say for example i have to display date according to culture set in web.confg so:

public object GetDateCulture(object date)
{
string uicul = ((System.Web.Configuration.GlobalizationSection)(System.Configuration.ConfigurationSettings.GetConfig("system.web/globalization"))).UICulture;
System.IFormatProvider format = new System.Globalization.CultureInfo(uicul, true);
date = Convert.ToDateTime(date).ToString("dd MMM yyyy", format);
return date;
}

Ouput will be:

if culture is english : 22 May 2009

if culture is dutch : 22 Mai 2009


Read More......

Call a C# Method from aspx Page

· 0 comments

Sometimes you need to call a method written in codebehind(.aspx.cs) from .aspx page.


Here is a simple example:


In your aspx page


<asp:Label ID="lbllable" runat="server" text='<%# GetCustomerID() %>' />

In your codebehind(.aspx.cs) page



  1. private string _CustomerID = "8888";

  2. protected void Page_Load(object sender, EventArgs e)

  3. {

  4. lbllable.DataBind();

  5. }

  6. public string GetCustomerID

  7. {

  8. get { return this._CustomerID; }

  9. }


When you are using in gridview or any other data bound control then


in your aspx page

<%# GetEmployee(Eval("EmpId"))%>


in your codebehind


public object GetEmployee(object EmpId)

{


EmpId = 1234;

return EmpId;

}

Read More......

Friday, May 29, 2009

Validating Checkboxlist using CustomValidator

· 11 comments

You might be knowing that required field validator doesn't works with required field validator... so to accomplish that purpose we can use custom validator to validate checkbox list.

<asp:CheckBoxList ID="chkModuleList"runat="server" >
</asp:CheckBoxList>




1) Using ClientValidationFunction


<asp:CustomValidator runat="server" ID="cvmodulelist" ClientValidationFunction="ValidateModuleList" ErrorMessage="Please Select Atleast one Module" ></asp:CustomValidator>

function ValidateModuleList(source, args)
{
var chkListModules= document.getElementById ('<%= chkModuleList.ClientID %>');
var chkListinputs = chkListModules.getElementsByTagName("input");
for(var i=0;i<
chkListinputs .length;i++)
{
if(
chkListinputs [i].checked)
{
args.IsValid = true;
return;
}
}
args.IsValid = false;
}

2) Using OnServerValidate


<asp:CustomValidator runat="server" ID="cvmodulelist" OnServerValidate="ValidateModuleList" ErrorMessage="Please Select Atleast one Module" ></asp:CustomValidator>

private void ValidateModuleList(object sender, ServerValidateEventArgs e)
{
int cnt= 0;


for(int i=0;i<chkModuleList.Items.Count;i++)
{
if(
chkModuleList.Items[i].Selected)
{
cnt++;
}


e.IsValid = (cnt== 0) ? false : true;
}
}



Read More......

Thursday, May 28, 2009

Learning Sql Server Joins In Form of Venn Diagrams

· 0 comments

Learn Basic Concepts of Sql joins like
Inner Join
Outer Join
Cross Join
Self Join

etc..
in the most simpler manner by pinal dave in the form of venn diagram.
He has explained sql joins with proper examples.. very good article for newbies on sql server

http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx

Read More......

Wednesday, May 27, 2009

Reset/Clear all fields - Textbox/Dropdown/Radionbuttonlist/Listbox etc of a web form in Asp.net

· 0 comments

In most of the case after inserting data into database or carrying out any other transactions. in which we have one form that contains bunch of textbox's, radiobuttonlist, checkboxlist, dropdownlist, checkbox, listbox etc or any other controls in asp.net .now after inserting data, on submit/save click we want to empty/reset/clear all controls in the web form, we actually do like this:

txtid.text ="";
ddid.SelectedIndex = -1;


and so on... and that for each textbox, dropdowns... etc it becomes very tedious and long.. so to make it short we should create a common function to reset all controls in web form...

Here is the ready made function :

Step 1:

///
/// Pankaj lalwani
/// Reset all textbox/radiobutton/dropdowns/listbox
///
///
public static void ClearFields(ControlCollection pageControls)
{
foreach (Control contl in pageControls)
{
string strCntName = (contl.GetType()).Name;
switch (strCntName)
{
case "TextBox":
TextBox tbSource = (TextBox)contl;
tbSource.Text = "";
break;
case "RadioButtonList":
RadioButtonList rblSource = (RadioButtonList)contl;
rblSource.SelectedIndex = -1;
break;
case "DropDownList":
DropDownList ddlSource = (DropDownList)contl;
ddlSource.SelectedIndex = -1;
break;
case "ListBox":
ListBox lbsource = (ListBox)contl;
lbsource.SelectedIndex = -1;
break;
}
ClearFields(contl.Controls);
}
}


Step 2:
Call this method on submit/save click after your code ends or sometimes when you provide clear/reset button to empty all fields


ClearFields(Form.Controls);

Read More......

Data Navigation with the ListView & GridView, DataPager and SliderExtender Controls

· 0 comments

Listview - Its a new control in asp.net 3.5, similar to gridview but much more capabilities than gridview..
Also Datapager - a new control in asp.net 3.5 used for data paging.
SliderExtender - a control of ajax toolkit

Combining all these three you can do wonders...

Below is an example of listview with datapager and slider extender

http://mattberseth.com/blog/2007/12/data_navigation_with_the_listv.html

Another example is of gridview with dataper and slider extender

http://www.dotnetcurry.com/ShowArticle.aspx?ID=219

The above links has source code to download, you can also view the live demo and play with the example..

Read More......

Monday, May 25, 2009

Learn Sql Server 2008 New Features With Demos, Presentations

· 0 comments

New to Sql Server 2008 - No need to worry, microsoft always is helpful in such cases.. Now you can learn new features of sql server 2008 interactively with fun, as it includes presentations, demos, hands on labs.. etc You can download the SQL Server 2008 Training Kit from the following link and follow the steps as given there.. also there are some basic system requirements need to be fulfilled while installing this toolkit.. all these are given below:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e9c68e1b-1e0e-4299-b498-6ab3ca72a6d7

Read More......

Saturday, May 23, 2009

Disable Copy/Paste in asp.net textbox

· 0 comments

Sometimes you don't want to allow user to copy/paste or (Ctrl + C)/(Ctrl + V) in asp.net textbox.

You have to use onCopy="return false" onPaste="return false"

Here is an example of that:

<asp:TextBox ID="tb_Email" runat="server"
onCopy="return false" onPaste="return false" ></asp:TextBox>


This will restrict user from directly copy/paste into textbox, they have to type manually.

Read More......

Set Language in Sql Server

· 0 comments

When you are working with multi lingual web applications, you may need to retrieve data like month name, day name etc to be displayed in different languages. For example month "June" is in English, its dutch translation would be "Juni" .This is possible with "Set Language languagname" feature of sql server. where language name is the name of language you want to set.. you can complete list of languages that sql support using

"select * from sys.syslanguages"

Below is one example using set language, retrieving day and month name in different languages:
DECLARE @Today DATETIME
SET @Today = '6/22/2009'

SET LANGUAGE Deutsch
SELECT DATENAME(month, @Today) AS 'Month Name in Dutch'
SELECT DATENAME(dw, @Today) AS 'Day Name in Dutch'

SET LANGUAGE us_english
SELECT DATENAME(month, @Today) AS 'Month Name in English'
SELECT DATENAME(dw, @Today) AS 'Day Name in English'

Read More......

Thursday, May 21, 2009

Integrating FCKeditor in Asp.net Websites

· 0 comments

You might be using textarea, to input large text, but formatting is not possible with that, for that you needed WYSIWYG editor. There are plenty of rich text editors available in the market, but i would recommend you to use FCK Editor which is opensource freely available. I have to implement FCKEditor with my Asp.net Website, the following link explains in detail how to integrate with your asp.net websites.

Part I:

http://www.codedigest.com/Articles/ASPNET/208_Integrating_FCKeditor_in_ASPNet_Websites_%E2%80%93_Part_1.aspx

Part II:

http://www.codedigest.com/Articles/ASPNET/217_Integrating_FCKeditor_in_ASPNet_Websites_–_Part_2.aspx

Read More......

Friday, May 15, 2009

FCK Editor With Custom Validation in Asp.net

· 0 comments

I have to keep validation for fckeditor in my application, but then i came to know that Requiredfield Validator control of asp.net does not work with fckeditor. So I used CustomValidator control of asp.net and it worked perfectly.

You might be aware that customvalidator works in both ways. either clientsidevalidation function using javascript and servervalidate. Difference between them is servervalidate method takes server trip while in clientsidevalidation all validations fire at once without server trip.

I will be showing you both ways:

1) Using ClientValidationFunction

<script language="javascript" type="text/javascript">
function ValidateFCK(source, args) {


var fckBody = FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID %>');
args.IsValid = fckBody.GetXHTML(true) != "";
}
</script>


<FCKeditorV2:FCKeditor ID="FCKeditor1" BasePath="../fckeditor/" runat="server">
</FCKeditorV2:FCKeditor>


<asp:CustomValidator runat="server" ErrorMessage="Please Enter Description" ID="CustValDesc" ControlToValidate="FCKeditor1"
ClientValidationFunction="ValidateFCK" ValidateEmptyText="True"></asp:CustomValidator>

Note: Sometimes this method does not works with multiple browsers.

2) Using OnServerValidate
<FCKeditorV2:FCKeditor ID="FCKeditor1" BasePath="../fckeditor/" runat="server">
</FCKeditorV2:FCKeditor>


<asp:CustomValidator runat="server" ErrorMessage="Please Enter Description" ID="CustValDesc" ControlToValidate="FCKeditor1"
ValidateEmptyText="True"
onservervalidate="CustValDesc_ServerValidate"></asp:CustomValidator>

protected void CustValDesc_ServerValidate(object source, ServerValidateEventArgs args)
{
if (FCKeditor1.Value == string.Empty )
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}

Note:

Whenever you are submitting form and you have kept validations, always check whether the page is valid or not by:
if (Page.IsValid)
{


//your code


}

I also found some other method which works for Requiredfield validator with fckeditor is
EnableClientScript="false" and

InitialValue="<br/>"

<asp:RequiredFieldValidator ID="req_Description" runat="server" ControlToValidate="FCKeditor1"
Display="Dynamic" InitialValue="<br/>" Text="Please Enter Description"
EnableClientScript="false"></asp:RequiredFieldValidator>

Read More......

Sunday, May 10, 2009

Add Themes To Your Flex Application

· 0 comments

Bored with your regular UI of your flex application, now make its look n feel better with ready themes.. there are number of themes available, just download them, add images, css, etc, to your flex application and here you go..your application is ready with beautiful themes.. you can also customize them according to your requirements..

http://www.scalenine.com/

Read More......

Friday, May 8, 2009

Salesforce for Asp.net Developers

· 1 comments

After learning some basics of salesforce, as discussed in previous post, if you want to integrate salesforce with asp.net, then you have to follow these steps as described in the below link.

http://wiki.developerforce.com/index.php/Force.com_for_ASP.NET_Developers
This article will show you how to create custom Force.com logic that you can call from within a Force.com application or from within a custom ASP.NET application hosted outside Salesforce.com with the help of webservice which interacts between force.com and asp.net..

Read More......

Wednesday, May 6, 2009

Working with view states in flex

· 3 comments

View state as name suggests while working in flex when you want to switch from one state to another state <mx:state> are used.

For example if you want to create login and register modules. so your first state is register and second state is login. so you can keep the register code in one state and set it as start state and keep the login code in another state. and after sucessful registration you want the login state to be enabled.. so you can achieve that using actionscript.. for all above you need to make use of <mx:state> below is the example i referred while accomplishing that...

http://blog.flexexamples.com/2007/10/05/creating-view-states-in-a-flex-application/

Read More......

Monday, May 4, 2009

Getting Started With Salesforce

· 0 comments

What is salesforce?

Salesforce.com is a vendor of Customer Relationship Management (CRM) solutions, which it delivers to businesses over the internet using the software as a service model.


There is no software needed for developement..everything is on internet

for more info on salesforce

http://en.wikipedia.org/wiki/Salesforce.com


Lets get started with developing applications with salesforce as a developer


1) Open the link in the browser


http://developer.force.com/


2) Register/Join Developer force by filling the registration form


3)You will receive your password in the registered email


4) open the link in the mail.. that will ask you for change password... change your password accordingly


5) you will be redirected to your developer force home page..


These were the steps i followed to get started with salesforce..


Now to create an application with salesforce, there are step by step flash tutorials, with screen shots and detailed explanation in the following link.


http://www.developerforce.com/flash_workbook/launch.html


The topics covered are :



  • Creating an application with Force.com IDE

  • Creating an application with Eclipse

  • Using Formulas and Validation

  • Using Workflows and Approvals

  • Using Apex

  • Adding Email Services

  • Adding Test to your application

  • Building User Interface with Visualforce

  • Create a Web page using force.com sites

  • Deploying an application

  • Packaging & Distributing an application


Also the above tutorials are available in e-book format.it's called Force.com Developer Workbook.. you can download it from here..


http://developerforce.s3.amazonaws.com/books/Forcedotcom_workbookv2.pdf


and practice the tutorials at your lease..

Read More......

Wednesday, April 29, 2009

Url Rewriting With Asp.net for SEO Friendly URL

· 0 comments

I have to implement url rewriting in one of my projects.. while searching net i got this link which was exactly that i needed.. that is url rewriting for implementing SEO friendly url.. this tutorial will help you for rewriting long urls to small ones.. this can be used when you do not need to show real url to users or search friendly url for google. but do remember this is different for each version of iis 5/6/7 or higher.. i will advice use to download urlrewrite.net from http://urlrewriter.net/ and follow the steps given in the link.. you can also implement extensionless url. there are different ways of implementing url rewriting like in application begin request of global.asax, httpmodule of urlrewriter, isapi filter and lots other.. with iis 7 its damn easy..only few lines code.. but with iis 5/6 its little difficult to implement...

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

Read More......

Flex for Designer/Developer/Manager/Architect

· 0 comments

Are you a designer or developer or programmer or manager or architect and want to learn flex.. here is a great resource i came through while myself learning flex. It gives live examples, with video training, examples for downloads, quick starts.etc...

http://www.adobe.com/devnet/flex/learn/

Also have a look at my previous post of learning flex in a week

http://pankajlalwani.wordpress.com/2009/04/15/flex-learn-flex-basics-in-a-week/

Read More......

Flex: Learn Flex Basics In a Week

· 0 comments

I have just started learning adobe flex. I have to start from scratch so i found nice link with interactive videos giving training on learning flex 3, with actionscript, almost all topics are covered. I will be posting more links, gradually as i myself learn flex.

http://www.adobe.com/devnet/flex/videotraining/

Read More......

Live Component Explorer for flex 3 with examples on Adobe's Site

· 0 comments

New to flex, dont know where to start from i will suggest you to first learn how flex components works.. really great site.. start with basics components, learn and practise yourself.. gradually you will master all components.. really flex 3 has wide ride range of components ranging button, tab, date, effects, chart and other visualisation controls.. you can check it out here..

http://examples.adobe.com/flex3/componentexplorer/explorer.html

Read More......

Resources For Flex Examples

· 0 comments

Here are some of great resources for flex examples, source codes and snippets, other developers code..

1)

http://blog.flexexamples.com/

the above site have source code of examples visible..

2)

http://www.adobe.com/cfusion/communityengine/index.cfm?event=homepage&productId=2

code snippets from various developers

Read More......

Flex Application Showcase

· 0 comments

Dont know how flex projects look after development..

here are bunch of live applications completely developed in flex..

http://flex.org/showcase/

Read More......

Saturday, March 7, 2009

Sharepoint FAQ’s — For Beginners

· 0 comments

A very good article for those who learning sharepoint….

http://www.dotnetfunda.com/articles/article200.aspx

Read More......

Get TextBox, RadioButtonList, DropDownList, CheckBoxes through JavaScript.

· 0 comments

In this article refers how to get value from asp.net controls like TextBox, RadioButtonList, DropDownList, CheckBoxes through JavaScript.

http://www.dotnetfunda.com/articles/article72.aspx

Read More......

3 Tier Architecture - A must known funda

· 0 comments

Well this is very important for those who are unaware with three tier architecture in asp.net.. almost all studying in college are either doing mashy coding.. but standards the industry follows must be known when they enter in this industry… ie 3 tier architecture.. it is also important for interview practical as well as technical interview.. 

i used to refer this article, it helped me alot…. here u can also download the complete project..

http://www.dotnetfunda.com/articles/article71.aspx

Read More......

Ajax FAQ’s — For Beginners

· 0 comments

Well while learning ajax i came through this link which is very useful for those who have just started about learning ajax..

http://www.dotnetfunda.com/articles/article239.aspx

Read More......

Sql Server Functions

· 0 comments

Most of us are unaware about various sql server functions..

we are only limited to functions we are knowing. but there are other useful functions which should be known.. do have a look they might be useful to you…

http://get-shorty.com/shorty/60464/

Read More......