private static int pageNumbers = 0;
protected void Page_Load(object sender, EventArgs e)
{
GetData();
if (IsPostBack && pageNumbers > 1)
{
this.panelPager.Controls.Clear();
for (int i = 0; i <>
{
LinkButton lnk = new LinkButton();
Label lblSpacer = new Label();
lblSpacer.Width = 3;
lnk.ID = i.ToString();
lnk.Text = (i + 1).ToString();
this.panelPager.Controls.Add(lnk);
this.panelPager.Controls.Add(lblSpacer);
lnk.Click += new EventHandler(lnk_Click);
}
}
}
public void GetData()
{
RekabuService.WebService rek = new RekabuService.WebService();
List
if (searchText != "")
propertyList = rek.GetProperties("userid='" + userId + "'", searchText, "id", 0, gvPropertyList.PageSize).ToList();
this.gvPropertyList.DataSource = propertyList;
this.gvPropertyList.DataBind();
CustomPaging(Convert.ToInt32(propertyList[0].totalCount));
}
private void CustomPaging(int recordCount)
{
if (recordCount % Convert.ToInt32(gvPropertyList.PageSize) > 0)
pageNumbers = recordCount / Convert.ToInt32(gvPropertyList.PageSize) + 1;
else
pageNumbers = recordCount / Convert.ToInt32(gvPropertyList.PageSize);
this.panelPager.Controls.Clear();
if (pageNumbers > 1)
{
for (int i = 0; i <>
{
LinkButton lnk = new LinkButton();
Label lblSpacer = new Label();
lblSpacer.Width = 3;
lnk.ID = i.ToString();
lnk.Text = (i + 1).ToString();
this.panelPager.Controls.Add(lnk);
this.panelPager.Controls.Add(lblSpacer);
lnk.Click += new EventHandler(lnk_Click);
}
}
}
void lnk_Click(object sender, EventArgs e)
{
LinkButton btn = (LinkButton)sender;
int offSet = Convert.ToInt32(btn.ID) * Convert.ToInt32(gvPropertyList.PageSize);
RekabuService.WebService rek = new RekabuService.WebService();
List
if (orderby != "")
propertyList = rek.GetProperties("userid='" + userId + "'", “”, orderby, offSet, Convert.ToInt32(gvPropertyList.PageSize)).ToList();
gvPropertyList.DataSource = propertyList;
gvPropertyList.DataBind();
}
1 comments:
Lengthy bahut hai
Post a Comment