Web Developer Friend

Archive for November 2009

Write View State at bottom of the Page for SEO Friendly Site

Posted by: viralsarvaiya on: November 24, 2009

first of all create class file named ‘basepage.vb’ and add this code to class file
then after inherit this class file from page
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim stringWriter As New System.IO.StringWriter
Dim htmlWriter As New HtmlTextWriter(stringWriter)
MyBase.Render(htmlWriter)
Dim html As String = stringWriter.ToString()
Dim StartPoint As Integer = html.IndexOf(“<input type=””hidden”” name=””__VIEWSTATE”””)
If StartPoint >= 0 Then
Dim EndPoint As Integer [...]

Date and Time Format Strings

Posted by: viralsarvaiya on: November 21, 2009

Date and time format strings are used to specify which formatting to apply when a datetime data type is represented as a string.
Date and time format strings fall into either standard or custom format strings. Standard datetime format strings are those that the framework has predefined for commonly used datetime patterns, while custom datetime format [...]

Windows Communication Foundation

Posted by: viralsarvaiya on: November 18, 2009

Windows Communication Foundation (WCF) is the latest service execution environment from Microsoft that enables you to seamlessly expose CLR types as services and consume services as CLR types. WCF is a unified programming model that combines the best of breed features from XML Web Services, .NET Remoting, MSMQ, and COM+ into an integrated platform that [...]

List of Table Constraints in sql server

Posted by: viralsarvaiya on: November 18, 2009

There five type of constrains provided by SQL Server. We shall see each one of then in details
1. Primary Key Constraint
A primary key is used to uniquely identify each row in a table. A primary key can consist of one or more then more columns in table. When they consist of more then one column [...]

List of HTTP headers

Posted by: viralsarvaiya on: November 13, 2009

HTTP Headers form the core of an HTTP request, and are very important in an HTTP response. They define various characteristics of the data that is requested or the data that has been provided. The headers are separated from the request or response body by a blank line. HTTP headers can be near-arbitrary strings, but [...]

Get HTML code from URL in ASP.NET

Posted by: viralsarvaiya on: November 10, 2009

To get HTML of web page you need only few lines of code.
To start, place two TextBox controls named txtURL and txtPageHTML, and one button control on web form, like in image bellow:

Now, on button’s click event function, place this code:
[ C# ]
// We need these namespaces
using System;
using System.Text;
using System.Net;
public partial [...]

Get Primary key – Foreign key relations table in sql server

Posted by: viralsarvaiya on: November 4, 2009

select * from information_schema.constraint_column_usage
This Query give the list of the table with the constraint
select * from information_schema.referential_constraints
this query give the list of the table with the foreign key constraint
now the query to find the relations
select
tblAll.table_name as Primary_TableName,
tblAll.column_name as Primary_TableColumn,
tblFK.table_name as ForeignKey_TableName,
tblFK.column_name as ForeignKey_ColumnName
from information_schema.constraint_column_usage tblAll
inner join information_schema.referential_constraints tblAllFK on
tblAllFK.unique_constraint_name = tblAll.constraint_name
inner join information_schema.constraint_column_usage tblFK on
tblAllFK.constraint_name=tblFK.constraint_name
Enjoy [...]

ASP.NET Gridview: Merging Cells

Posted by: viralsarvaiya on: November 4, 2009

I had been searching for a way to merge cells in a GridView
If e.Row.DataItemIndex % 2 = 0 Then
e.Row.Cells(0).RowSpan = 2
e.Row.Cells(1).RowSpan = 2
End If
‘Remove the extra cells created due to row span for odd rows
If e.Row.DataItemIndex % 2 = 1 Then
e.Row.Cells.RemoveAt(0)
e.Row.Cells.RemoveAt(0)
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
End If
This code should take every cell in the first and second columns [...]

Retrieving Data as XML from SQL Server

Posted by: viralsarvaiya on: November 2, 2009

All the hype that once surrounded XML is finally starting to die down, and developers are really beginning to harness the power and flexibility of the language. XML is a data descriptive language that uses a set of user-defined tags to describe data in a hierarchically-structured format.
The release of Microsoft SQL Server 2000 a couple [...]


Blog Stats

  • 5,866 hits