Archive for May, 2008

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 = [...]

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.