Posts

Showing posts from August, 2010

Access ViewState From ClassFile

teHello Friends Manytime we need to use ViewState while working 3-tier Architecture but its difficult to use it. here i have made a sample to use Viewstate from Classfile ViewState: Viewstate is an object of Class StateBag  Here is sample of Viewstate in Class file in this example we will add names from Textbox to gridview using Viewstate. so in code behind <div> Name : <asp:TextBox ID="txtName" runat="server"></asp:TextBox><asp:Button ID="btnAdd" runat="server" Text="Add" /> </div> <div> <asp:GridView ID="grvNames" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> ...

Get Nth record from Table

Hello Friends Here is a simple query to get nth Record from Table SELECT @NewPriority=Priority FROM ( SELECT Id , Priority , ROW_NUMBER() OVER (ORDER BY priority) as row FROM Job where IsDeleted=0 and Id not in ( select jobId from Job_Cylinder where IsDeleted=0) ) a WHERE row=@cnt-(@NewPriority)+1 There are many ways to get this.. All the Best