Sunday, September 5, 2010
Remove Contact Link From IPAD Safari Browser First of all you have to detect Browser that Ipad safari or not i write below javascript for remove contact link from IPAD Safari browser.
$("#btnDelete").click(function () {
var gvw = document.getElementById("tblCert");
var cnt = gvw.rows.length - 1;
var certno = "";
var twt = 0;
var A = 0; B = 0; newD = 0;
var isiPad = navigator.userAgent.match(/iPad/i) != null; //Check For Browser
var RecordStatusID = "";
for (var i = 1; i < cnt; i++) {
if (gvw.rows[i].cells[15].childNodes[1].childNodes[0].checked) {
if (isiPad == true && gvw.rows[i].cells[11].childNodes.length == 3) {
gvw.rows[i].cells[11].innerHTML=gvw.rows[i].cells[11].childNodes[1].innerHTML; //Here We Remove Link From browser
}
}
on Below Example i got link in IPAd safari browser gvw.rows[i].cells[11].innerHTML in this column i got link in IPAd safari browser.First of all i find that like <a href="tel:34734687468">34734687468</a> According to this first i find Child Node length and browser is ipad or not like below line
if(isiPad == true && gvw.rows[i].cells[11].childNodes.length == 3)
if my column contain then i got length 3 else i got 1
simple solution occure then i assign value like below
gvw.rows[i].cells[11].innerHTML=gvw.rows[i].cells[11].childNodes[1].innerHTML;
finally i remove link from ipad safari browser .for more detail comment us.i reply as soon as possible.
Saturday, September 4, 2010
This article looks at some of the basics of ASP .Net with a small sample program which writes "Hello World" in the browser.
ASP .Net Class Model:
The ASP .Net has been built on a collection of classes over the .Net framework. Each control, behavior etc., are implemented using one/many of the .Net classes. These classes could be present either in the Global Assembly Cache (GAC) or the local WWWRoot directories.In this model, a web page is derived from System.Web.UI.Page, a user control is derived from System.Web.UI.UserControl, the controls are derived from System.Web.UI.WebControls and tables are derived from System.Web.UI.WebControls.Table etc., The most beautiful feature is all these controls can be accessed via intellisense inside Visual Studio .Net.
All the HTML and FORM elements defined in a web page are now available as server controls viz., Text Boxes, Labels, List boxes, Dropdown list controls, Tables etc., All of them can be processed on the server (even enabling each control with a client side javascript validations).
The Compiled Page Serving/Execution model in ASP .Net:
ASP .Net in contrast to older technolgy(ASP), has a compiled model. ASP had an interpreted model where the web server will interpret the .asp page every time when a request for the page is made. But with ASP .Net, the first time load of any page is slower. The reason is because the page gets compiled when the first person makes the request. But subsequently, the pages are loaded at a much faster rate as the server has to execute only the compiled code.The file extensions of asp .net are .aspx. The forms in these aspx files can still follow either a "Get" or "Post" Method mechanisms. The major difference in asp .net over the classic asp programming is, the previous model needed atleast two pages for a form post process. i.e., one file for collecting the data and one file for processing the data. With asp .net there is no need for a second file. The same web page can post the data to itself.
Here is one small sample code, which takes input from a text box inside a web form and displays the input on submitting the form.
<%@ Page language="c#" AutoEventWireup="true"%>
<script language="C#" runat="server">
private void Button1_Click(object sender, System.EventArgs e)
{
lblSample.Text = txtSample.Text;
}
≷/script>
<form id="Form1" method="post" runat="server">
<P> <asp:Label id="lblSample" runat="server" Width="208px">Label</asp:Label></P>
<P> <asp:Label id="Label1" runat="server" Width="104px">Enter Text Here:</asp:Label>
<asp:TextBox id="txtSample" runat="server"></asp:TextBox></P>
<P> <asp:Button id="Button1" runat="server" Text="Submit" OnClick="Button1_Click"></asp:Button> </P>
</form>
The above code can be pasted on to an aspx page and opened in Internet Explorer as http://servername/virtualdirectoryname/sample_page1.aspx. If the folder on which this page is hosted is not configured as a virtual directory in IIS using inetmgr, then the page will not load and will return some errors.
If this page is written using Webmatrix, then executing this asp .net page is a straight forward mechanism. Open the file in webmatrix and press F5 key. This will automatically open it on a web browser.
The above page can also be written with a clear separation of the Presentation Layer from the Processing Layer. The .aspx page can be made to host just the HTML and another .cs file can hold the business logic. This is dealt in another article titled Using Code behind in Asp .net.
Script Output:
First Name | Last Name | Sales |
---|---|---|
Andrew | Fuller | 5000 |
Janet | Leverling | 6250 |
Steven | Buchanan | 3245 |
Margaret | Peacock | 4685 |
Robert | King | 5290 |
David | Andersen | 6420 |
Frank | Edwards | 3840 |
Kate | Richards | 4260 |
Edward | Jones | 3450 |
Laura | Callahan | 3675 |
Greg | Miller | 5640 |
Tammy | Steel | 3570 |
<>
's. This little script will take an XML file and an XSL file and combine them to produce whatever output you want. The sample files (xmlxsl.xml and xmlxsl.xsl) contain a copy of some of our fake sample data and convert it to a basic HTML table, but you can use the same code to transform your data into whatever you want... just change the stylesheet.
Using Remote XML/XSL Files
If you're going to be pulling either the XML of XSL file from a remote server, you should take a look at the remote version of this sample: XML to HTML (via XSL) - Remote Files.Update: Common Functions for Working with XML and XSL Files
One of our readers read our sample and decided to share a few functions that he's been using to handle his XML and XSL needs. Here's his email:I've just looked at XML to HTML (via XSL) Classic ASP Sample, and I realised that I've written a few (5) functions for doing this, but with a few enhancementsNo Chris... Thank You! I sure many of our users will find the functions extremely helpful. Oh and speaking of the functions, here they are: server-xml.zip (1 KB). Like Chris said, they're pretty simple to figure out and there are basic comments included with the source. Thanks again Chris.
The functions are:
- You can do everything in one function call
- The more complicated functions call the simpler ones, keeping everything clean
- You can pass parameters into your stylesheet straight from the function call
Here is the pure file (complete with pseudo XML comments) - I'll write up a little guide to the code if you like it. It's not doing anything special, but I don't think I've noticed anything quite like it being posted before.
GetXslStyleSheet(ByVal strStyleSheetLocation)
GetXslStyleSheetWithParams(ByVal strStylesheetLocation, ByVal strParams)
GetXmlDocument(ByVal strDocumentLocation)
GetXmlDocumentByStyleSheet(ByVal strDocumentLocation, ByVal strStyleSheetLocation)
GetXmlDocumentByStyleSheetWithParams(ByVal strDocumentLocation, ByVal strStyleSheetLocation, ByVal strParams)
Thanks
Chris Surfleet
by ASP.NET · 0
Script Output:
First Name Last Name Sales
Andrew Fuller 5000
Janet Leverling 6250
Steven Buchanan 3245
Margaret Peacock 4685
Robert King 5290
David Andersen 6420
Frank Edwards 3840
Kate Richards 4260
Edward Jones 3450
Laura Callahan 3675
Greg Miller 5640
Tammy Steel 3570
By now I'm sure you're probably using XML files for something. Whether it be data transfer, storage, caching, or something else altogether, it's a great technology. Anyway, my point is that you've probably got a few XML files lying around your website. While XML is designed to be human readable as much as it is machine readable, sometimes it's nice to look at something without the <>'s.
This little script will take an XML file and an XSL file and combine them to produce whatever output you want. The sample files (xmlxsl.xml and xmlxsl.xsl) contain a copy of some of our fake sample data and convert it to a basic HTML table, but you can use the same code to transform your data into whatever you want... just change the stylesheet.
Using Remote XML/XSL Files
If you're going to be pulling either the XML of XSL file from a remote server, you should take a look at the remote version of this sample: XML to HTML (via XSL) - Remote Files.
Update: Common Functions for Working with XML and XSL Files
One of our readers read our sample and decided to share a few functions that he's been using to handle his XML and XSL needs. Here's his email:
I've just looked at XML to HTML (via XSL) Classic ASP Sample, and I realised that I've written a few (5) functions for doing this, but with a few enhancements
1. You can do everything in one function call
2. The more complicated functions call the simpler ones, keeping everything clean
3. You can pass parameters into your stylesheet straight from the function call
The functions are:
* GetXslStyleSheet(ByVal strStyleSheetLocation)
* GetXslStyleSheetWithParams(ByVal strStylesheetLocation, ByVal strParams)
* GetXmlDocument(ByVal strDocumentLocation)
* GetXmlDocumentByStyleSheet(ByVal strDocumentLocation, ByVal strStyleSheetLocation)
* GetXmlDocumentByStyleSheetWithParams(ByVal strDocumentLocation, ByVal strStyleSheetLocation, ByVal strParams)
Here is the pure file (complete with pseudo XML comments) - I'll write up a little guide to the code if you like it. It's not doing anything special, but I don't think I've noticed anything quite like it being posted before.
Thanks
Chris Surfleet
No Chris... Thank You! I sure many of our users will find the functions extremely helpful. Oh and speaking of the functions, here they are: server-xml.zip (1 KB). Like Chris said, they're pretty simple to figure out and there are basic comments included with the source. Thanks again Chris.
How to Use the ListBox Control in ASP.NET 2.0
(Page 1 of 6 )
Any developer who is using the Listbox control in his applications needs to be aware of how data binding has changed from VS 2003 to ADO.NET 2.0. This article will explain the changes. It appears to be an improvement over the previous techniques used.Introduction
While the concept of data binding has not changed, the mechanics and objects involved in data binding have changed from VS2003 (.NET Framework 1.1x) to ADO.NET 2.0. This can be easily seen by comparing the Toolbox items in VS2003 and VS2005 as shown in the next two pictures. The connection, command, transactions, parameters have been replaced by the DataSource Controls. The data binding in ASP.NET 2.0 relies on the data binding expressions and the data source controls. This tutorial is about the ListBox control and how it is bound to data. It should interest those who might be using ListBox Control in their applications. You will see for yourselves how much better off you will be using the Data Source Controls in ADO.NET 2.0.
The ListBox control displays items in a list appearing sequentially and vertically in a scrollable window. It may display single or multiple items. It usually displays items by pulling the information from memory and formatting them according to the way they are requested. The ListBox control as seen in the Object Browser of VS 2005 has its inheritance as shown in the next paragraph.
Public Class ListBox Inherits System.Web.UI.WebControls.ListControl Member of: System.Web.UI.WebControls Summary: Represents a list box control that allows single or multiple item selection.
This inheritance is common to the other type of list controls as well, such as DropDownList, CheckBoxList, RadioButtonList and the BulletItemList which is new in VS 2005.
Because of this inheritance one can access a large number of properties, methods and events of the list controls in applications shown in the Object Browser.
How to Use the ListBox Control in ASP.NET 2.0 - Usage of the ListBox Control in web pages
(Page 2 of 6 )
In an article on VS2003 an example of binding a ListBox control using a DataReader was shown. ListBox can be used to display not only data from a backend
On Using the AccessDataSource Control
The AccessDataSource control takes you the very center of RAD. Writing code is almost reduced to a single line. No more connection strings that tangle here, there and everywhere. Most of what you want to do can be done at design time. The IDE even gives you a query editor. An earlier article shows how you may use this data source control with a large number of screen shots. A few major screen shots are shown here.
Step 1
You must first add a source to the data connection, which will add the nwind.mdb file on your local drive as shown in the
Step 2
Next you bring the connection to the App_Data folder of your website. When this is accomplished your website should appear as shown in the following picture.
How to Use the ListBox Control in ASP.NET 2.0 - ListBox Examples
(Page 3 of 6 )
Simple List
This example shows filling a ListBox with several items at design time. The next picture shows the ListBox on the design pane filled in with three items. The List Items Collection Editor dialog can be popped up by clicking on an empty space in the items collection property in the List Box properties window shown in the same picture on its right. In this Editor you can begin adding items by providing Key/ Value pairs as shown for "New Jersey."
Another way of doing this is to follow the ListBox tasks as shown in the next picture by clicking the smart tags arrow attached to the ListBox. This will be discussed later in the tutorial.
Partial Class Simplelist
Inherits System.Web.UI.Page
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles _
ListBox1.SelectedIndexChanged
TextBox1.Text = ListBox1.SelectedValue.ToString
End Sub
End Class
The source
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Simplelist.aspx.vb" Inherits="Simplelist" %>
<!DOCTYPE
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="
<title>Simple List</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" runat="server"
AutoPostBack="true" >
<asp:ListItem Value="NJ">New Jersey</asp:ListItem>
<asp:ListItem Value="C0">Colorado</asp:ListItem>
<asp:ListItem Value="NY">New York</asp:ListItem>
</asp:ListBox>
<asp:TextBox ID="TextBox1" runat="server" Text=''>
</asp:TextBox></div>
</form>
</body>
</html>
The result of opening this page in the browser and selecting any of the list items will display its key value in the textbox as shown in the next picture.
This example is similar to the previous one, but the Selected Item's value is bound to the textbox with a binding expression as shown in the code used for the "text" property of the textbox. Adding items to the ListBox is similar to the previous example. The ListBox and the textbox are tied up in the form1_load() event as shown in the following snippet for the code behind for this page, BindingExp.aspx.
Partial Class BindingExp Inherits System.Web.UI.Page Protected Sub form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles form1.Load DataBind() End Sub End Class
The source code for this page (BindingExp.aspx) is shown in the following listing.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="BindingExp.aspx.vb" Inherits="BindingExp" %>
<!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>Bound List</title>
</head> <body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" runat="server"
AutoPostBack="true">
<asp:ListItem Value="57">John</asp:ListItem>
<asp:ListItem Value="35">Tom </asp:ListItem>
<asp:ListItem Value="22">Lisa</asp:ListItem>
</asp:ListBox>
<asp:TextBox ID="TextBox1" runat="server" Text="<%#
ListBox1.SelectedValue %>">
</asp:TextBox></div>
</form>
</body>
</html> How to Use the ListBox Control in ASP.NET 2.0 - Dynamic binding to data at run time
(Page 4 of 6 )
There are two ways you can populate the list with backend data. Well, not exactly two ways so much as two procedures using the same AccessDataSource Control.
Example 1: The Long hand
The first of these is a roundabout way of getting the result. It still uses the AccessDataSource control by starting off using its connectionString as shown in the following (litany?) snippet. This was how data was accessed using ADO.NET 1.0.
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As New AccessDataSource
ds = AccessDataSource1
Response.Write(ds.ConnectionString)
Dim mycon As New OleDbConnection
Dim conStr As String = ds.ConnectionString
mycon.ConnectionString = conStr
mycon.Open()
Response.Write("<h2>" & mycon.State & "</h2>")
Dim myCmd As New OleDbCommand
myCmd.Connection = mycon
myCmd.CommandType = Data.CommandType.Text
myCmd.CommandText = ds.SelectCommand.ToString
Try
Dim dr As OleDbDataReader = myCmd.ExecuteReader
Response.Write(dr.HasRows)
'Dim str As String = ""
While dr.Read
ListBox1.Items.Add(dr.Item("CustomerID") & _
"," & dr.Item("CompanyName") & "," & _
dr.Item("LastName") & "," & _
dr.Item("City") & "," _
& dr.Item("HomePhone"))
'Response.Write(str)
End While
dr.Close()
Catch ex As System.Data.OleDb.OleDbException
Response.Write(ex.Message)
End Try
mycon.Close()
End Sub
End Class
You may recall that this code is similar to what was formerly used in the VS2003 and described in a previously referenced article. The Design pane of this page (Default.aspx) is shown in the next picture followed by the source
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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="
<title>Longwinded</title>
</head>
<body>
<form id="form1" runat="server">
<div id="DIV1" runat="server">
<asp:ListBox ID="ListBox1" runat="server"
AppendDataBoundItems="True" AutoPostBack="false"
Height="172px" Width="650px" >
</asp:ListBox><asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT Customers.CustomerID,
Customers.CompanyName, Customers.ContactName,
Employees.LastName, Employees.City, Employees.HomePhone,
Orders.OrderDate
FROM ((Customers INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID)
INNER JOIN Employees ON
Orders.EmployeeID = Employees.EmployeeID)
WHERE (Orders.OrderDate > #5/1/1998#)">
</asp:AccessDataSource>
<asp:Button ID="Button1" runat="server"
Text="Button" /></div>
</form>
</body>
</html>
The code behind shown for this CodeBound.aspx is simple and effortless thanks to the ADO.NET 2.0 DataSource controls. Some of the AccessDataSource controls' properties are used. The source code listing is also simpler as shown. The design pane of this example is exactly the same as in the previous example (Default.aspx). For this example you add the ListBox to the design pane and attach the datasource; you can get drop-down hints for writing the code.
First, the code behind the click event of the button.
Imports System.Data.OleDb
Partial Class CodeBound
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As New AccessDataSource
ds = AccessDataSource1
Dim sqlstr As String = "Select * from Customers"
ds.SelectCommand = sqlstr
ListBox1.DataSource = ds
ListBox1.DataValueField = "CustomerID"
ListBox1.DataTextField = "CompanyName"
ListBox1.DataBind()
End Sub
End Class
The source code listing of CodeBound.aspx is much simpler than the previous case as shown below. Less code is the key word here.
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="CodeBound.aspx.vb" Inherits="CodeBound" %>
<!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>Code Bound</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" runat="server" Height="177px"
Width="333px">
</asp:ListBox><asp:AccessDataSource
ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT [CustomerID], [CompanyName],
[City], [Phone] FROM [Customers]">
</asp:AccessDataSource>
<br />
<br />
<asp:Button ID="Button1" runat="server"
Text="Button" /></div>
</form>
</body>
</html>
This page gets rendered as shown in the next picture when the button is clicked.
How to Use the ListBox Control in ASP.NET 2.0 - Databound ListBox Example
(Page 5 of 6 )
In the previous two examples the ListBox was not bound to data at design time (see the design pane). In the following example the ListBox is bound to the DataSource as seen in the design view of this page, BoundList.aspx.
<!DOCTYPE
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" runat="server"
DataSourceID="AccessDataSource1"
DataTextField="ContactName"
DataValueField="City"
AutoPostBack="True" >
</asp:ListBox><asp:AccessDataSource ID="AccessDataSource1"
runat="server" DataFile="~/App_Data/nwind.mdb"
SelectCommand="SELECT [CustomerID], [CompanyName],
[ContactName],
[Address], [City], [Phone] FROM [Customers]" >
</asp:AccessDataSource>
</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</form>
</body>
</html>
There is no code behind to populate the list. The list is bound to data at design time. This is indeed an excellent enhancement for those who do not want to use the code but who are adept at designing using the IDE. There is some code behind but that is only for displaying a selected value in a textbox as show here.
Partial Class BoundList
Inherits System.Web.UI.Page
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles _
ListBox1.SelectedIndexChanged
TextBox1.Text = ListBox1.SelectedValue
End Sub
End Class
The following picture shows how this page gets rendered when the button is clicked. Note that the ListBox's Selected value really references the DataFieldValue in the source code.
How to Use the ListBox Control in ASP.NET 2.0 - Steps in converting a Unbound ListBox to a Bound ListBox
(Page 6 of 6 )
The starting point is to drop a ListBox control on the design pane. Then click the smart tag arrow attached to the ListBox at top right to open the tasks window as shown.
In this wizard use the drop-down to choose AccessDataSource1. This may open up other drop-downs. Since you are not sure of the item and the dropdown does not show any items, just click OK.
This tutorial described the various ways a ListBox server control in ASPNET 2.0 gets populated with either hard coded data or data from a backend database. An MS
The ListBox event can be put to good use in drilling down on the data. Much of the drudgery encountered in ADO.NET 1.0 is removed for good. When configuring tasks it is advisable to switch to the source code and verify that the elements are properly configured. If you still want to use the tortuous route, you can take the route suggested in one of the examples.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
<html>
<body>
<form runat="server">
<table border="0" bgcolor="#b0c4de">
<tr valign="top">
<td colspan="4"><h4>Compare two values</h4></td>
</tr>
<tr valign="top">
<td><asp:TextBox id="txt1" runat="server" /></td>
<td> = </td>
<td><asp:TextBox id="txt2" runat="server" /></td>
<td><asp:Button Text="Validate" runat="server" /></td>
</tr>
</table>
<br />
<asp:CompareValidator
id="compval"
Display="dynamic"
ControlToValidate="txt1"
ControlToCompare="txt2"
ForeColor="red"
BackColor="yellow"
Type="String"
EnableClientScript="false"
Text="Validation Failed!"
runat="server" />
</form>
</body>
</html>
What is Java technology and why do I need it?
This article applies to:
- Platform(s): All Platforms
- Java version(s): All JRE Versions
Why do I need Java?
There are lots of applications and websites that won't work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!Is Java free to download?
Yes, Java is free to download. Get the latest version at http://java.com.If you are building an embedded or consumer device and would like to include Java, please contact Oracle for more information on including Java in your device.
Why should I upgrade to the latest Java version?
The latest Java version contains important enhancements to improve performance, stability and security of the Java applications that run on your machine. Installing this free update will ensure that your Java applications continue to run safely and efficiently.MORE TECHNICAL INFORMATION