This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @proc varchar(255), @dynamicSql varchar(255), @ParamDefinition varchar(255), @Actor1 nvarchar(255),@Actor2 nvarchar(255) | |
SET @proc = 'OnScreenChemistry' | |
--*cursor declare/fetch stuff* | |
--set @Actor1, @Actor2 values here from your cursor | |
--create your query with placeholders for the parameters to your stored proc | |
SET @dynamicSql = 'exec ' + @proc + '@Actor1Param,@Actor2Param,@ResultParam output' | |
--create definitions for your parameter placeholders | |
Set @ParamDefinition = '@Actor1Param nvarchar(255) ,@Actor2Param nvarchar(255), @ResultParam float(53) output' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @dynamicSql = 'exec ' + @proc + ' ''' + @Actor1 + ''', '''+@Actor + '''' | |
EXECUTE sp_ExecuteSQL @dynamicSql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<asp:Repeater ID="Repeater1" runat="server"> | |
<HeaderTemplate> | |
<ul id="navi"> | |
</HeaderTemplate> | |
<ItemTemplate> | |
<li> | |
<a href='<%#DataBinder.Eval(Container.DataItem, "ArticleURL")%>'> | |
<%#DataBinder.Eval(Container.DataItem, "Name")%> | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tr><td> | |
<asp:PlaceHolder ID="plcPaging" runat="server" > | |
<asp:LinkButton ID="prevLnk" Text = "Prev" runat="server" OnClick="prev_Click"/> | |
<asp:Label ID="prevspacer" Text = " " runat="server" /> | |
<asp:LinkButton ID="lnkPage1" Text = "1" runat="server" OnClick="lnk_Click"/> | |
<asp:Label ID="spacer1" Text = " | " runat="server" /> | |
<asp:LinkButton ID="lnkPage2" Text = "2" runat="server" OnClick="lnk_Click"/> | |
<asp:Label ID="spacer2" Text = " | " runat="server" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int itemsPerPage = 2; | |
private CurrentProperties _CurrentProps = new CurrentProperties(); | |
[Serializable()] | |
private struct CurrentProperties | |
{ | |
public int RowCount; | |
public int CurrentPage; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (!Page.IsPostBack) | |
LoadData(itemsPerPage, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void LoadData(int take, int pageSize) | |
{ | |
//somehow return all the objects you need. could be a datatable instead of a list of objects | |
List articles = GetAllItems(); | |
//set total item count | |
RowCount = articles.Count; | |
var topDocs = (from c in articles select c).Skip(pageSize).Take(take); | |
PagedDataSource pagedSrc = new PagedDataSource(); | |
pagedSrc.DataSource = topDocs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void LoadItemsBasedOnCurrentPage() | |
{ | |
int take = CurrentPage * itemsPerPage; | |
int skip = CurrentPage == 1 ? 0 : take - itemsPerPage; | |
LoadData(take, skip); | |
} | |
protected void prev_Click(object sender, EventArgs e) | |
{ | |
LinkButton lnk = sender as LinkButton; | |
CurrentPage--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// sets the paging control's properties | |
/// </summary> | |
protected void FormatPagingControl() | |
{ | |
//number of page links | |
int n = 4; | |
int lastpage = ((RowCount -1) / itemsPerPage) + 1; | |
int startPage = CurrentPage; | |
int lastPageToDisplay = Math.Min(lastpage, startPage + (n-1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
class Node | |
{ | |
int state;//current state of clocks | |
byte[] moves;//past moves done | |
public Node(int state, byte[] oldMoves, Byte lastMove) | |
{ |
OlderNewer