How to use Asp.net
  • Home
  • About us
  • Disclaimer
  • joy of helping
KEEP IN TOUCH

Monthly archives for October, 2011

How can we limit the characters in multiline textbox asp.net using JavaScript

Oct20
2011
4 Comments Written by vikram

Hello there, sometimes we need to restrict the character length in Multiline Textbox and we know we can achieve by our logic in code-behind. Why don’t we try JavaScript? So I found something and modify it according to my need.  Following the code which will restrict the limit of characters in TextBox.

 

Create web form [Default2.aspx] and copy paste the source code in it

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default2.aspx.cs” Inherits=”Default2″ %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

 

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Untitled Page</title>
<script  language=”JavaScript” type=”text/javascript”>
//****  for master page the control name will be changed so you can access those name under source code.
//**** it could  be –> ctl00$ContentPlaceHolder1$txt_commnets so u have to change it where u will use the textbox.
//****  and form name could be –> aspnetForm instead of Form1
var max=50;             // 50  = max characters // we can set according to our need.

READ MORE »

Posted in jQuery

How can create Google Visualization: Geomap in asp.net

Oct19
2011
Leave a Comment Written by vikram

Well after searching and reading some articles on GEO-Map  I found an article in which they have used the Json  with static WEBMETHOD members  but my  problem was to display the records in GRIDVIEW which is not possible to bind the control inside the static WEBMETHOD then I created a following code and method through which I achieved my result so  I thought why don’t make it an article on it and post it so it will be helpful for others too so, here the following code. Hope you will enjoy it.

*And I have created a database almost 252 countries and more than 4200+ states so you can edit if you found any mistake in it.

Click here download the Script.

Create a webform name default.aspx and paste the source code in it.

SOURCE CODE

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head runat=”server”>

<title>Untitled Page</title>
<script src=”scripts/jquery-1.3.2.min.js” type=”text/javascript”></script>
<script type=’text/javascript’ src=’http://www.google.com/jsapi’></script>
<script src=’http://maps.google.com/maps?file=api&v=2&key=ABCDEFG’ type=’text/javascript’></script>

</head>
<body>

READ MORE »

Posted in Asp.net

How to do Shopping Cart in Asp.net C#

Oct07
2011
8 Comments Written by vikram

Hello there, I am just trying to do Shopping Cart simple way. Hope it will help you. To create a shopping cart we almost used the Product Details like Quantity, Price, Code etc. and we can add it more columns according to requirement. Well in this article I m using only two pages name Products.aspx and shopping_cart.aspx from Products page I will send the id of product code to shopping cart page and fill the Gridview with the product detail after getting the id from Query string. Well copy the following Database Script.
*you can use product title and description as well in database.

DATABASE SCRIPT

DATABASE SCRIPT
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[tbl_Product]‘) AND type in (N’U'))
BEGIN
CREATE TABLE [dbo].[tbl_Product](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[Image] [nvarchar](200) NULL,
[Title] [nvarchar](50) NULL,
[description] [nvarchar](max) NULL,
[our_price] [bigint] NULL,
[size] [nvarchar](20) NULL,
[Product_quantity] [bigint] NULL CONSTRAINT [DF_tbl_Product_Product_quantity]  DEFAULT ((0)),
[Product_code] [nvarchar](20) NULL,
[date] [datetime] NULL CONSTRAINT [DF_tbl_Product_date]  DEFAULT (getdate()),
CONSTRAINT [PK_tbl_Product] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END

 

In your Website Add two pages and name it.
(i) Products.aspx
(ii) Shopping_Cart.aspx
Add DATALIST control on Products.aspx page,
(to learn how to bind DATALIST refer this link:-  http://howtouseasp.net/datalist-paging-with-editing-deleting-and-updating-with-ado-net-way-c/
Add GRIDVIEW  control on Shopping_Cart.aspx,
(to learn how to bind GRIDVIEW refer this link:-  http://howtouseasp.net/how-to-use-gridview-with-insert-edit-update-delete-the-ado-net-way-c/

READ MORE »

Posted in Asp.net

Joy of Helping

Any sort of help to the children who are fatherless, poor & are from far-off areas.
Joy of Helping

Facebook Link

Asp dot Net ,Ajax,Xml.

Recent Posts

  • ROW_NUMBER(), NTILE(), partition by, Duplicate Records, CTE sql server 2008
  • How to get second highest Salary sql server 2008
  • Insert values, insert into, insert default value, insert execute and select into sql server 2008
  • How to Bind GridView with SqlDataReader in Asp.net
  • how to attach files to email without storing on disk using Asp.net FileUpload control

Recent Comments

  • Anonymous on ROW_NUMBER(), NTILE(), partition by, Duplicate Records, CTE sql server 2008
  • dhananjay on How to use GridView with Insert, Edit, Update, Delete the Ado.net way C#
  • dev on How can we limit the characters in multiline textbox asp.net using JavaScript
  • navneet on How to display image in Image control after upload on the server asp.net C#
  • AnhVu on How to do Shopping Cart in Asp.net C#

Archives

  • February 2013
  • September 2012
  • April 2012
  • January 2012
  • October 2011
  • August 2011
  • May 2011
  • April 2011
  • March 2011

Categories

  • Asp.net
  • jQuery
  • Sql Server

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

EvoLve theme by Theme4Press  •  Powered by WordPress How to use Asp.net