Session Time Out Limit

May 6, 2008

Session Default Time Out is 20 minutes

Maximum we can set up to 4,000  years,,,,,

Session.TimeOut=Minutes.

2,147,483,647

Base 64 Bit Encoding and Decoding

May 6, 2008

string Order = “Ord12011982″;
#region Encode
byte[] Enc = ASCIIEncoding.UTF7.GetBytes(Order);
string EncString = Convert.ToBase64String(Enc);

#endregion
#region Decode
byte[] Dec = Convert.FromBase64String(EncString);
string b = ASCIIEncoding.UTF7.GetString(Dec);
#endregion
Tou can al use UTF8,UTF32

Instead of DataBinder.Eval use DataRowView

May 6, 2008

<%# ((DataRowView)Container.DataItem)["name1"] %>

This One  is the  Best One……..While using DataBinder.Eval()

If your Record exeecds than 100 Rows..It Will become a Problem.More duplication Will Occur.

To Change the GridView Lines Color

May 6, 2008

<asp:DataGrid ID=”DataGrid1″ runat=”server” AutoGenerateColumns=”False”
BorderColor=”Black” BorderStyle=”Solid” BorderWidth=”1px” Width=”300px” PageSize=”7″>
<Columns>
<asp:TemplateColumn ItemStyle-BorderColor=”blue” ItemStyle-BorderStyle=”solid” ItemStyle-BorderWidth=”2px”>
<ItemTemplate>
<center>
<asp:Label ID=”Label1″ runat=”server” Text=’Hello’></asp:Label>
</center>
</ItemTemplate>
<HeaderStyle HorizontalAlign=”Center” />
</asp:TemplateColumn>
<AlternatingItemStyle BackColor=”Gainsboro” BorderColor=”White” />
<HeaderStyle BackColor=”Gray” />
<EditItemStyle BorderColor=”White” />
<ItemStyle BorderColor=”White” />
</asp:DataGrid>

Dynamically Read Assembly File in C#.NET

May 6, 2008

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Web;
using System.IO;
using System.Net;

namespace ConsoleExample
{
class LoadAssembly
{
public void LoadAssembly_FromFile()
{
Assembly Ass = System.Reflection.Assembly.LoadFrom(”D:\\Decisions.Shared.dll”);
Type Asstype = Ass.GetType();

#region Get Constructor Info
ConstructorInfo[] I = Asstype.GetConstructors();
#endregion

#region Extractiong Properties Info
PropertyInfo[] PrInfo = Asstype.GetProperties();
#endregion

#region Extracting Method Info
MethodInfo[] MeInfo = Asstype.GetMethods();
Console.WriteLine(”Return Parameter \t” + MeInfo[0].ReturnType);
Console.WriteLine(”Name \t” + MeInfo[0].Name);
Console.WriteLine(”Module \t” + MeInfo[0].Module);
Console.WriteLine(”Method Body \t” + MeInfo[0].GetMethodBody());
Console.ReadLine();
#endregion

#region Extracting Event Info
EventInfo[] EveInfo = Asstype.GetEvents();
#endregion
Console.ReadLine();
}
}
}

Add Constraints to the Existing Table

May 6, 2008

ALTER TABLE B ADD CONSTRAINT ID2_2  FOREIGN KEY(ID2) REFERENCES DBO.A(ID1)  ON DELETE CASCADE ON UPDATE CASCADE

Aboe:

B->Table Name

ID2_2 -> Foreign Key Name

DBO.A(ID1) -> A-Reference Table.ID1 That table Primary Key

I am implemented cascade delete and Update  while creating the constraints.

Text Box Initialization when it is Password Mode in .NET

February 6, 2008

If u r having a textbox in a form.The textmode of the textbox is Password.

Under this type of situation if u want to initialize a password while the page load we will normally gave at the Page_Load

TextBox1.Text=”Hi”;

But the above wont’t work when the TextBox mode is set to password. To do this write the below code at the page Load

TextBox1.Attributes.Add(”value”,”Hi”); //This work Fine

Text Reader in .NET

February 6, 2008

FileInfo File = new FileInfo(”D:\\READ\\ec_books_new.txt”);
if (File.Exists)
{
TextReader Tr = new StreamReader(”D:\\READ\\ec_books_new.txt”)
string Line;
Line = Tr.ReadLine();
while (Line != null)
{
Console.WriteLine(Line);
Line=Tr.ReadLine();
}
}

Money Convertor WebService Link

February 6, 2008

Difference between Hyperlink and LinkButtton in ASp.NET

February 6, 2008

To the Web page visitor, a HyperLink control and a LinkButton control look identical. However, there is a significant difference in functionality.

The HyperLink control immediately navigates to the target URL when the user clicks on the control. The form is not posted to the server.

The LinkButton control first posts the form to the server, then navigates to the URL. If you need to do any server-side processing before going to the target URL, use a LinkButton.

On the other hand, if there is no server-side processing necessary, don’t waste a round trip and use the HyperLink control.