Wednesday, July 8, 2009

crating pager in datalist



private void LoadImage(string FolderName)

{

try {

string wallFolderPath = Server.MapPath(FolderName);

string[] FilesColl = Directory.GetFiles(wallFolderPath);

if (FilesColl.Length > 0) {

int tempLength = FilesColl.Length;

for (int i = 0; i < extn =" Path.GetExtension(FilesColl[i]).ToLower();" extn ="=" extn ="=" extn ="=" fs =" new" fn="fs.Name;" fktitle="Path.GetFileName(FilesColl[i]).Replace(extn," drow =" dtWall.NewRow();" imagepath =" FilesColl[i];" imagepath="imagePath.Substring(imagePath.IndexOf(parentImageDir)+parentImageDir.Length+1);" datasource="dtWall.DefaultView;" allowpaging="true;" pagesize =" 16;" currentpageindex =" CurrentPage;" enabled =" !pds.IsLastPage;" enabled =" !pds.IsFirstPage;" datasource="pds;" text="dtWall.Rows.Count.ToString();">0) {




LnlBack.Visible=false;

}

}

catch(Exception ex)

{

ShowError(ex.Message);

}

}




public int CurrentPage

{




get

{

if (this.ViewState["CurrentPage"] == null)

return 0;

else

return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());

}




set

{

this.ViewState["CurrentPage"] = value;

}




}

private void doPaging()

{

DataTable dt = new DataTable();

dt.Columns.Add("PageIndex");

dt.Columns.Add("PageText");

for (int i = 0; i < dr =" dt.NewRow();" datasource =" dt;" currentpage =" Convert.ToInt16(e.CommandArgument.ToString());" wallfoldername =" ViewState[" lnkbtnpage =" (LinkButton)e.Item.FindControl(" enabled =" false;" bold =" true;" wallfoldername =" ViewState[" wallfoldername =" ViewState[">
HTML
asp1:datalist1 id="dlPaging" runatr="serverr" RepeatDirection="Horizontal" Height="15px">

ItemTemplate1>
asp1:LinkButton1 ID="lnkbtnPaging" runatr="serverr" CommandArgument=<# DataBinder.Eval(Container.DataItem,"PageIndex") > CommandName="lnkbtnPaging" Text=<# DataBinder.Eval(Container.DataItem,"PageText") >'> /asp1:LinkButton1 /ItemTemplate1> /asp1:datalist

1 comment:

Anonymous said...

Great post, I am almost 100% in agreement with you