I need a sample or the best approach for the following case.The page is placeholded on a master page.To simplify, there are a single GridView, two TextBoxes with dates (StartDate, EndDate) and a Screen button on it.\[code\]<asp:TextBox id="StartDateTextBox" runat="server" /><asp:CalendarExtender ... />to<asp:TextBox id="EndDateTextBox" runat="server" /><asp:CalendarExtender ... /><asp:Button ID="ScreenButton" runat="server" Text="Screen" onClick="ScreenBtn_Click" /><asp:ObjectDataSource ID="ODSPositions" runat="server" EnablePaging="True" TypeName="managetraderelay.PositionsDB" SelectMethod="GetPositions" SelectCountMethod="CountPositions" /><asp:UpdatePanel ID="GridViewUpdatePanel" runat="server" RenderMode="Block"><ContentTemplate><asp:GridView ID="grid" runat="server" DataSourceID="ODSPositions" AutoGenerateColumns="False" AllowSorting="False" AllowPaging="True" PageSize="20"> <EmptyDataTemplate> <asp:Label ID="NoDataLabel" runat="server">No Records Found</asp:Label> </EmptyDataTemplate> <Columns> <asp:boundfield datafield="positiondate" dataformatstring="{0:dd.MM.yyyy ddd}" headertext="Date"/> <asp:boundfield datafield="symbol" headertext="Symbol"/> <asp:boundfield datafield="descrpt" headertext="Description"/> <asp:boundfield datafield="bsc" headertext="Action"/> <asp:boundfield datafield="qty" headertext="Quantity" ItemStyle-HorizontalAlign="Right" /> <asp:boundfield datafield="mktprice" headertext="Close Price" ItemStyle-HorizontalAlign="Right" /> <asp:boundfield datafield="mktvalue" headertext="Mkt Value" ItemStyle-HorizontalAlign="Right" /> </Columns></asp:GridView></ContentTemplate></asp:UpdatePanel>\[/code\]C# class methods for ObjectDataSource (this is not code-behind)\[code\]public List<PositionsDetails> GetPositions(int startRowIndex, int maximumRows){ positions page = HttpContext.Current.Handler as positions; SqlConnection con = new SqlConnection(connString); SqlCommand cmd = new SqlCommand("admin_positions", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@start", SqlDbType.Int, 4).Value = http://stackoverflow.com/questions/15459189/startRowIndex + 1; cmd.Parameters.Add("@count", SqlDbType.Int, 4).Value = http://stackoverflow.com/questions/15459189/maximumRows; cmd.Parameters.Add("@suser", SqlDbType.VarChar, 20).Value = http://stackoverflow.com/questions/15459189/HttpContext.Current.User.Identity.Name; //cmd.Parameters.Add("@startdate", SqlDbType.Date).Value = http://stackoverflow.com/questions/15459189/DateTime.ParseExact(page.StartDateTextBoxText,"dd.MM.yyyy", null); //cmd.Parameters.Add("@enddate", SqlDbType.Date).Value = http://stackoverflow.com/questions/15459189/DateTime.ParseExact(page.EndDateTextBoxText,"dd.MM.yyyy", null); List<PositionsDetails> positionslist = new List<PositionsDetails>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { PositionsDetails pos = new PositionsDetails((DateTime)reader["PositionDate"], (string)reader["Symbol"], (string)reader["Descrpt"], (string)reader["BSC"], (decimal)reader["Qty"], (decimal)reader["MktPrice"], (decimal)reader["MktValue"]); positionslist.Add(pos); } reader.Close(); return positionslist; } catch ... finally ...}public int CountPositions(){ SqlConnection con = new SqlConnection(connString); SqlCommand cmd = new SqlCommand("admin_positions_count", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@suser", SqlDbType.VarChar, 20).Value = http://stackoverflow.com/questions/15459189/HttpContext.Current.User.Identity.Name; try { con.Open(); return (int)cmd.ExecuteScalar(); } catch ... finally ...}\[/code\]T-SQL\[code\]CREATE PROCEDURE admin_positions@start INT,@count INT,@suser VARCHAR(20),@startdate DATE,@enddate DATEASSELECT positiondate, symbol, descrpt, bsc, qty, mktprice, mktvalue FROM (SELECT ROW_NUMBER() OVER (ORDER BY positiondate ASC) AS ROWNUM, CONVERT(DATE, positiondate, 104) AS positiondate, symbol, descrpt, bsc, CAST(qty AS DECIMAL(15,0)) AS qty, CAST(mktprice AS DECIMAL(15,2)) AS mktprice, CAST(mktvalue AS DECIMAL(15,2)) AS mktvalue FROM Trades.Positions WHERE userid = (SELECT revuserid FROM Users.SUsers WHERE suname=@suser) AND positiondate BETWEEN @startdate AND @enddate) AS POSWHERE ROWNUM BETWEEN @start AND @start + @count - 1GOCREATE PROCEDURE admin_positions_count@suser VARCHAR(20)--@startdate DATE,--@enddate DATEASSELECT COUNT(positionid) FROM Trades.PositionsWHERE userid = (SELECT revuserid FROM Users.SUsers WHERE suname=@suser)--AND positiondate BETWEEN @startdate AND @enddateGO\[/code\]The problems:[*]With \[code\]<asp:ObjectDataSource />\[/code\] it runs perfect for all data paging. When I comment out StartEnd and EndDate. I don't know how to get it right with these dates selected in TextBoxes by hitting 'Screen' button.[*]Seems I need to put ObjectDataSource with all it's settings and binding in the code-behing, not as \[code\]<asp:ObjectDataSource />\[/code\] How to make it right with paging and some default start & end dates running on page starting or on button hitting? Also there are some additional functions in code-behing such as database updating. I need to call a single method to screen (refresh) data anywhere in the code. How should I pass StartDate/EndDate parameters and bind GridView correctly?[*]How should \[code\]grid_PageIndexChanging(object sender, GridViewPageEventArgs e)\[/code\] look like in code-behind?I don't need caching or sorting in GridView. Just pass additional parameters with paging.Thank you!