Unable to render html in ascx control page - c#

Here is my ascx control page code
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="Menu.ascx.cs" Inherits="CrossQueue.Web.Menu" %>
<asp:Label ID="lblMenu" runat="server"></asp:Label>
Here is my c# code
private void CreateMenu()
{
StringBuilder menuHtml = new StringBuilder();
int profileId = 0;
MenuBL menuManager = new MenuBL();
DataTable dtMenu = null;
if (Session["USR_ID"] != null)
{
profileId = Convert.ToInt32(Session["USR_PROFILE"]);
dtMenu = menuManager.GetAllMenuItemsForProfile(profileId);
if (dtMenu != null && dtMenu.Rows.Count > 0)
{
menuHtml.Append("<table id='tblMenu' cellpadding='0' cellspacing='0' width='939' border='0' align='center'>");
menuHtml.Append("<tr>");
menuHtml.Append("<td align='left'>");
menuHtml.Append(Convert.ToString(Session["USR_USERNAME"]));
menuHtml.Append("</td>");
menuHtml.Append("<td width='739' valign='middle' align='right' style='height: 30px;'>");
foreach (DataRow dr in dtMenu.Rows)
{
if (dr["MenuName"].ToString() == "Profile")
{
menuHtml.Append("<img src='/images/home_icon.jpg' width='25' height='25' align='middle' /><a href='AllProfile.aspx>Profile</a> ");
}
else if (dr["MenuName"].ToString() == "User")
{
menuHtml.Append("<img src='/images/home_icon.jpg' width='25' height='25' align='middle' /><a href='AllUsers.aspx>User</a> ");
}
}
menuHtml.Append("</td>");
menuHtml.Append("</tr>");
menuHtml.Append("</table>");
}
lblMenu.Text = menuHtml.ToString();
}
}
When i load the page i only see a html code printed as text and not rendering.Can any one point out what may be wrong

You could use a literal instead of a label.
See this
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.aspx

You can make a div server accessible by assigning ID and setting runat="server" instead of label and set its InnerHTML = menuHtml.ToString();
<div id="div1" runat="server" ></div>
div1.InnerHTML = menuHtml.ToString();

change the Label
<asp:Label ID="lblMenu" runat="server"></asp:Label>
to Literal as
<asp:Literal ID="lblMenu" runat="server" EnableViewState="false"></asp:Literal>

Related

Check TreeView has any Node selected or not?

I have a treeview control on my aspx page and a button.on the basis of treeview node selection I want to show and hide the button.but when initially page loads there is no any seleceted node that's in if condition it is generating exception.Can anyone tell me that how can i find that is there any node selected or not ?
//Here I want to check is there any selected node "ApplicationTree.Nodes.Count>0"
<%if(ApplicationTree.Nodes.Count>0)
{%>
<%
//Here it is generating exception because initially no any node is selected
IsReviewPending = view_access.IsWaitingForViewAccess(ApplicationTree.SelectedNode.Value, Session["empCode"].ToString());
if (IsReviewPending)
{
CanReviewAccess = true;
}
else
{
CanReviewAccess = false;
}
%>
<%if(CanReviewAccess)
{%>
<asp:Button ID="btn_Review_Access" OnClick="btn_Review_Access_Click" runat="server" BackColor="#C6304A" ForeColor="White" Text="Confirm Access Review" Width="200px" CssClass="center3" />
<%} %>
<%} %>
I found the solution :)
//Here is my Code
<%
bool HasSelectedNode = false;
//i iterated through the overall nodes of the tree and checked any of the node is selected or not
for (int i = 0; i < ApplicationTree.Nodes.Count;i++ )
{
if(ApplicationTree.Nodes[i].Selected==true)
{
HasSelectedNode = true;
}
}
%>
<%if(HasSelectedNode)
{%>
<%
IsReviewPending = view_access.IsWaitingForViewAccess(ApplicationTree.SelectedNode.Value, Session["empCode"].ToString());
// IsReviewPending = true;
if (IsReviewPending)
{
CanReviewAccess = true;
}
else
{
CanReviewAccess = false;
}
%>
<%if(CanReviewAccess)
{%>
<asp:Button ID="btn_Review_Access" OnClick="btn_Review_Access_Click" runat="server" BackColor="#C6304A" ForeColor="White" Text="Confirm Access Review" Width="200px" CssClass="center3" />
<%} %>
<%} %>

Hide a column in one repeater based on the value of a checkbox in another

I have a product listing page which has several divs set up to look like a table. The product listing is inside one of two repeaters. The outer most repeater (called locationRepeater) sets the location area name for each batch of products (Public Areas, Showers and Sinks), and the second repeater (areaRepeater) generates the listing of products (I can't go back and redo the code so I only use 1 repeater--there's no time for that):
<asp:Repeater ID="locationRepeater" runat="server" OnItemDataBound="SetInner">
<ItemTemplate>
<div class="LocationName">
<%# Eval("SecOpen") %><%# Eval("LocationName")%> <%# Eval("SecClose") %>
</div>
<asp:Repeater ID="areaRepeater" runat="server">
<HeaderTemplate>
<div class="headerRow">
<div class="header">
<div class="thumb"><p></p></div>
<div class="headerField name"><p class="hField">Product</p></div>
<div class="headerField sku"><p class="hField">GOJO SKU</p></div>
<div class="headerField size"><p class="hField">Size</p></div>
<div class="headerField case"><p class="hField">Case Pack</p></div>
<div class="headerField qty"><p class="hField">Add to Shopping List</p></div>
</div>
</div>
</HeaderTemplate>
<ItemTemplate>
<asp:placeholder id="LocationAreaHeader" runat="server" visible='<%# (Eval("AreaName").ToString().Length == 0 ? false : true) %>' ><h3> <%# Eval("AreaName") %></h3></asp:placeholder>
<asp:placeholder id="ProductTable" runat="server" visible='<%# (Eval("ProductName").ToString().Length == 0 ? false : true) %>' >
<div class="table">
<div class="row">
<div class="thumb"><%# Eval("Charm") %></div>
<div class="field name"><p class="pField"> <%# Eval("ThumbOpen") %><%# Eval("ProductName") %><%# Eval("ThumbClose") %></p> </div>
<div class="field sku"><p class="pField"> <%# Eval("Sku") %> </p></div>
<div class="field size"><p class="pField"> <%# Eval("Size") %></p></div>
<div class="field case"><p class="pField"> <%# Eval("CasePack") %> </p></div>
<asp:PlaceHolder runat="server" ID="ShoppingField">
<div class="field qty"><p class="pField"> <asp:checkbox id="LineQuantity" runat="server" /></p></div>
</asp:PlaceHolder>
</div>
</div>
<asp:Label id="productID" text='<%# Eval("productID") %>' visible="false" runat="server" />
</asp:placeholder>
<!-- Stored values -->
<asp:Label id="SkuID" runat="server" text='<%# Eval("SkuID") %>' visible="true" />
<asp:Label id="masterSku" runat="server" text='<%# Eval("masterSku") %>' visible="false" />
<asp:Label id="masterName" runat="server" text='<%# Eval("masterName" ) %>' visible="false" />
<asp:Label ID="test" visible="false" runat="server" text='<%# Eval("AreaID") %>' />
</ItemTemplate>
</asp:Repeater>
<asp:Label ID="refID" visible="false" runat="server" text='<%# Eval("LocationID") %>' />
</ItemTemplate>
</asp:Repeater>
In the template for the product listing page is a checkbox called "Shopping Disabled" which is meant to hide a column from the areaRepeater's product listing table if it's checked. However, the "Shopping Disabled" checkbox exists inside the first repeater (locationRepeater). How can I hide the "Add to Shopping" column based on a value found inside the creation of the locationRepeater?
private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Item CurrentItem = Sitecore.Context.Item;
DataSet ds = new DataSet();
DataTable locations = ds.Tables.Add("locations");
locations.Columns.Add("LocationName", Type.GetType("System.String"));
locations.Columns.Add("LocationID", Type.GetType("System.String"));
locations.Columns.Add("SecOpen", Type.GetType("System.String"));
locations.Columns.Add("SecClose", Type.GetType("System.String"));
string secColor = "";
if (CurrentItem.TemplateName == "gojoProductLocation")
{
Sitecore.Data.Fields.CheckboxField checkbox = CurrentItem.Fields["Active"];
if (checkbox.Checked)
{
DataRow dr = locations.NewRow();
dr["LocationName"] = CurrentItem.Fields["Header"].Value;
dr["LocationID"] = CurrentItem.ID.ToString();
locations.Rows.Add(dr);
}
}
else
{
Item HomeItem = ScHelper.FindAncestor(CurrentItem, "gojoMarket");
if (HomeItem != null)
{
Item ProductGroup = HomeItem.Axes.SelectSingleItem(#"child::*[##templatename='gojoMarketOfficeBuildigProductMap']/*[##templatename='gojoProductList']");
if (ProductGroup != null)
{
//this is where I can get the value of the "Shopping Disabled" checkbox
Sitecore.Data.Fields.CheckboxField checkBox = ProductGroup.Fields["Shopping Disabled"];
if (checkBox.Checked)
{
submitBtn.Visible = false;
}
Item[] LocationList = ProductGroup.Axes.SelectItems(#"child::*[##templatename='gojoProductLocation' and #Active = '1']");
if (LocationList != null)
{
foreach (Item LocationItem in LocationList)
{
DataRow dr = locations.NewRow();
secColor = LocationItem.Fields["Section Color"].Value;
dr["SecOpen"] = "<h1 style='padding-top: 10px; background-color:#" + secColor + "'>";
dr["LocationName"] = LocationItem.Fields["Header"].Value;
dr["LocationID"] = LocationItem.ID.ToString();
dr["SecClose"] = "</h1>";
locations.Rows.Add(dr);
}
}
}
}
}
locationRepeater.DataSource = ds;
locationRepeater.DataMember = "locations";
locationRepeater.DataBind();
if (locationRepeater.Items.Count == 0)
{
//show message -RTE field on product map page
Literal lit = (Literal)FindControl("Return");
}
}
}
//This function populates the second repeater, which has the "Add to Shopping" column I want to hide
protected void SetInner(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType != ListItemType.Footer) & (e.Item.ItemType != ListItemType.Header))
{
Label refID = (Label)e.Item.FindControl("refID");
Label test = (Label)e.Item.FindControl("test");
Repeater areaRepeater = (Repeater)e.Item.FindControl("areaRepeater");
Database db = Sitecore.Context.Database;
Item LocationAreaItem = db.Items[refID.Text];
if (LocationAreaItem != null)
{
Item[] AreaList = LocationAreaItem.Axes.SelectItems(#"child::*[##templatename='gojoProductLocationArea' and #Active = '1']");
if (AreaList != null)
{
DataSet dset = new DataSet();
DataTable areas = dset.Tables.Add("areas");
string secColor = "";
areas.Columns.Add("AreaName", Type.GetType("System.String"));
areas.Columns.Add("Sku", Type.GetType("System.String"));
areas.Columns.Add("Large Image", Type.GetType("System.String"));
areas.Columns.Add("Charm", Type.GetType("System.String"));
areas.Columns.Add("ProductName", Type.GetType("System.String"));
areas.Columns.Add("masterSku", Type.GetType("System.String"));
areas.Columns.Add("masterName", Type.GetType("System.String"));
areas.Columns.Add("Size", Type.GetType("System.String"));
areas.Columns.Add("CasePack", Type.GetType("System.String"));
areas.Columns.Add("SkuID", Type.GetType("System.String"));
areas.Columns.Add("AreaID", Type.GetType("System.String"));
areas.Columns.Add("productID", Type.GetType("System.String"));
areas.Columns.Add("ThumbOpen", Type.GetType("System.String"));
areas.Columns.Add("ThumbClose", Type.GetType("System.String"));
foreach (Item AreaItem in AreaList)
{
DataRow drow = areas.NewRow();
drow["AreaName"] = AreaItem.Fields["Header"].Value;
drow["AreaID"] = AreaItem.ID.ToString();
areas.Rows.Add(drow);
Item[] SkuList = AreaItem.Axes.SelectItems(#"child::*[(##templatename='gojoPTRefill' or ##templatename = 'gojoPTAccessories' or ##templatename = 'gojoPTDispenser' or ##templatename = 'gojoPTSelfDispensed') and #Active = '1']");
foreach (Item ChildItem in SkuList)
{
Item MarketProduct = db.Items[ChildItem.Fields["Reference SKU"].Value];
drow["productID"] = ChildItem.ID.ToString();
if (MarketProduct != null)
{
Item MasterProduct = db.Items[MarketProduct.Fields["Master Product"].Value];
if (MasterProduct != null)
{
DataRow newRow = areas.NewRow();
if (MasterProduct.TemplateName == "gojoSKUSelfDispensed" || MasterProduct.TemplateName == "gojoSKURefill")
{
newRow["Size"] = MasterProduct.Fields["Size"].Value;
}
else
{
newRow["Size"] = "N/A";
}
Sitecore.Data.Fields.XmlField fileField = ChildItem.Fields["Charm"];
newRow["Charm"] = "<image src=\"" + ScHelper.GetCorrectFilePath(fileField) + "\" border=\"0\" alt=\"\">";
newRow["Sku"] = MasterProduct.Fields["SKU"].Value;
newRow["productID"] = ChildItem.ID.ToString();
newRow["CasePack"] = MasterProduct.Fields["Case Pack"].Value;
newRow["Large Image"] = "";
try
{
string prodNameLink = "";
Item MasterProductName = db.Items[MasterProduct.Fields["Complete Product Name"].Value];
string prodImg = MasterProduct.Fields["Large Image"].Value;
if (prodImg != "")
{
Sitecore.Data.Fields.XmlField productImg = MasterProduct.Fields["Large Image"];
prodNameLink = MasterProduct.Fields["Large Image"].Value;
newRow["ThumbOpen"] = string.Format("<a href=\"{0}\" class=\"fancybox\" title=\"{1}\" rel=\"image\">", ScHelper.GetCorrectFilePath(productImg), MasterProduct.Fields["SKU"].Value);
newRow["ThumbClose"] = "</a>";
}
if (MasterProductName != null)
{
newRow["ProductName"] = MasterProductName.Fields["Complete Name"].Value;
}
areas.Rows.Add(newRow);
}
catch (Exception x)
{
Response.Write(x.Message.ToString() + "<br />");
}
}
}
}
}
areaRepeater.DataSource = dset;
areaRepeater.DataMember = "areas";
areaRepeater.DataBind();
}
}
}
}
There are likely better ways to handle this but since you are already using the approach of storing data in hidden fields (ex: "refID") you can take this same approach for the "Shopping Disabled" field.
Add a new Column to your DataTable in your Page_Load:
locations.Columns.Add("ShoppingDisabled", Type.GetType("System.String"));
Add the shopping disabled data to this Column in your Page_Load:
dr["ShoppingDisabled"] = checkBox.Checked;
locations.Rows.Add(dr);
Add the hidden label to your User Control:
<asp:Label ID="ShoppingDisabled" visible="false" runat="server" text='<%# Eval("ShoppingDisabled") %>' />
Grab the label in your SetInner() method:
Label lblShoppingDisabled = (Label)e.Item.FindControl("ShoppingDisabled");
Add logic to your SetInner() method or the user control to hide what you ever you need to hide based on lblShoppingDisalbed.Text.
If I am understanding correctly, you are looking to hide a column which is represented as a div?
If this is the case add the attribute runat="server" to your div that you wish to hide.
In the code behind you will then be able to use findcontrol to find the checkbox, areaRepeater, and the div and then you will be able to set the visibility of the div based on your checkbox.
It would be something like:
foreach(Repeater rep in locationRepeater.Items)
{
Repeater areaRepeater = (Repeater)rep.FindControl("areaRepeater");
CheckBox disable = (CheckBox)rep.FindControl("checkboxid");
foreach(Repeater areaRep in areaRepeater.Items)
{
HtmlGenericControl div = (HtmlGenericControl)areaRep.FindControl("div");
div.Visible = disable.Checked;
}
}
Ok, so, what I ended up doing was creating a function that got the value of the "Shopping Disabled" checkbox and set a boolean variable to either true or false based on that. I then called this function inside the "visible" property of both the "Add To Shopping List" header and the checkbox field in the product listing table. This allowed me to show/hide that column as needed. Thanks for the suggestions, though!

Foreach loop in Aspx page how to add checkbox and label

Foreach loop in Aspx page how to add checkbox and label values from datatable . Recieve all ticked checkbox value.
I have written this code in aspx page not in aspx.cs .
<% foreach (Employee myEmp in _empList) {
empName = myEmp.ToString(); %>
<div class="abc">
<div class="pqr">
<asp:Label Text="<% empName %>" runat="server" ID="lblEmpName"></asp:Label></label>
</div>
<div class="xyz">
<asp:CheckBox ID="chkBox" Checked="false" runat="server" />
</div>
</div>
<% } %>
I think you're just missing the : or = for the label. <% should be <%:. Use : to encode any html and avoid js injection. More info on = vs :
<% foreach (Employee myEmp in _empList) {
empName = myEmp.ToString(); %>
<div class="abc">
<div class="pqr">
<asp:Label Text="<%: empName %>" runat="server" ID="lblEmpName"></asp:Label>
</div>
<div class="xyz">
<asp:CheckBox ID="chkBox" Checked="false" runat="server" />
</div>
</div>
<% } %>
You can do something like this:
List<user> userList = new List<user>();
foreach (user usr in userList)
{
PlaceHolder1.Controls.Add(new CheckBox()
{
ID = "cb_"+usr.UserId,
Text = usr.Name,
});
}
I think the best way to add controls dynamically to asp.net page is oninit page-event.
you should try something like this.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
/*LinkButton lb = new LinkButton();
lb.ID = "lbAddFilter";
pnlFilter.Controls.Add(lb);
lb.Text = "Add Filter";
lb.Click += new EventHandler(lbAddFilter_Click);*/
// regenerate dynamically created controls
foreach ( var employee in employeeList)
{
Label myLabel = new Label();
// Set the label's Text and ID properties.
myLabel.Text = "Label" + employee.Name.ToString();
myLabel.ID = "Label" + employee.ID.ToString();
CheckBox chkbx = new CheckBox();
chkbx.ID = "CheckBox" + employee.ID.ToString();
chkbx.Text = "Label" + employee.Name.ToString();
MyPanel.Controls.Add(myLabel);
MyPanel.Controls.Add(chkbx);
}
}

Access the Repeater.Item.Count value within a codebehind method

I have a repeater on my page:
<asp:Repeater id="attachmentsRepeater" runat="server">
<HeaderTemplate>
<%
if (attachmentsRepeater.Items.Count > 0) {
if (attachmentsRepeater.Items.Count == 1) {
Response.Write("<h3>Attachment</h3>");
Response.Write("<p>");
} else {
Response.Write("<h3>Attachments</h3>");
Response.Write("<ul>");
}
}
%>
</HeaderTemplate>
<ItemTemplate>
<%# OutputAttachment(Container)%>
</ItemTemplate>
<FooterTemplate>
<%
if (attachmentsRepeater.Items.Count > 0) {
if (attachmentsRepeater.Items.Count == 1) {
Response.Write("</p>");
} else {
Response.Write("</ul>");
}
}
%>
</FooterTemplate>
</asp:Repeater>
The original ItemTemplate code looked like this:
<ItemTemplate>
<%
if (attachmentsRepeater.Items.Count > 0) {
if (attachmentsRepeater.Items.Count > 1) {
Response.Write("<li>");
}
%>
<a href="<%# DataBinder.Eval(Container.DataItem, "location") %>">
<%# DataBinder.Eval(Container.DataItem, "name") %>
</a>
<%
if (attachmentsRepeater.Items.Count > 1) {
Response.Write("<li>");
}
}
%>
</ItemTemplate>
In the codebehind, I would like to access the number of Items in the Repeater (line 4):
public string OutputAttachment(RepeaterItem Container) {
string returnValue = "";
Repeater ContainerParent = (Repeater)Container.Parent;
if (attachmentsRepeater.Items.Count > 0) {
if (attachmentsRepeater.Items.Count > 1) {
returnValue += "<li>";
}
returnValue += "<a href=\"" + DataBinder.Eval(Container.DataItem, "location");
if (DataBinder.Eval(Container.DataItem, "location").ToString().EndsWith("/")) {
returnValue += DataBinder.Eval(Container.DataItem, "name");
}
returnValue += ">" + DataBinder.Eval(Container.DataItem, "name") + "</a>";
if (attachmentsRepeater.Items.Count > 1) {
returnValue += "</li>";
}
}
return returnValue;
}
The code that is output is
<h3>Attachment</h3>
<p> </p>
From this output I know that Item.Count == 1 since there is output, the H3 is singular and there is a P tag. If Item.Count > 1, H3 would be plural and there would be a UL tag.
Is this codebehind method being run before the data is bound? Any workarounds for this? Thanks for your help.
This was working for me before, but I had to change it to fulfill a new requirement, which is when it stopped working.
The best place to do your data binding is in the code behind in the page_load event or some other event that is fired when the page is first created.
That way you can control when the data is bound - and you can call the OuputAttachment method after you have bound your data - and you can be sure that the data actually exists.

custom paging in gridview

I am looking for paging(Top,Bottom) functionality for gridview(or any databind controls)
i am using .net framework 2.0.
i would like to have pointers
thank you
solution:
i used jQuery plugin jquery.tablePagination.0.1.js for my solution
You can asp:repeater for this this can easily handle by Repeater control.
This aspx page code
<asp:Repeater ID="rptImages" runat="server" onitemcommand="rptImages_ItemCommand">
<ItemTemplate >
<div class="image"> <a ><asp:Image ID="Image1" runat="server" imageUrl=' <%# Eval("ImageUrl") %>' /></a> </div>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="rptPages" Runat="server"
onitemcommand="rptPages_ItemCommand">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" border="0">
<tr class="text">
<td><b style="color:White;">Page:</b> </td>
<td>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="btnPage" ForeColor="White"
CommandName="Page"
CommandArgument="<%#
Container.DataItem %>"
CssClass="text"
Runat="server"><%# Container.DataItem %>
</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
this code behind page code
public void LoadData()
{
try
{
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dtImage);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 8;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPages.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPages.DataSource = pages;
rptPages.DataBind();
}
else
rptPages.Visible = false;
rptImages.DataSource = pgitems;
rptImages.DataBind();
}
catch { }
}
public int PageNumber()
{
get
{
if (ViewState["PageNumber"] != null)
return Convert.ToInt32(ViewState["PageNumber"]);
else
return 0;
}
set
{
ViewState["PageNumber"] = value;
}
}
public void itemGet()
{
try
{
var Images = dataContext.sp_getCards(categoryId);
PagedDataSource pds = new PagedDataSource();
pds.DataSource = Images;
pds.AllowCustomPaging = true;
pds.AllowPaging = true;
pds.PageSize = 8;
pds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ pds.PageCount.ToString();
// Disable Prev or Next buttons if necessary
//cmdPrev.Enabled = !pds.IsFirstPage;
//cmdNext.Enabled = !pds.IsLastPage;
rptImages.DataSource = pds;
rptImages.DataBind();
}
catch { }
}
protected void rptPages_ItemCommand(object source, RepeaterCommandEventArgs e)
{
try
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
LoadData();
}
catch { }
}
This will be hardly achievable in GridView because it uses rigid table structure with only single pager template. You need two - one on the top and one on the bottom. For such control you need Repeater (.NET 2.0) or ListView (.NET 3.5). When you have buttons placed you can handle their click or command events and rebind your grid to newly selected set of data. In repeater you will probably have to store current page and number of items per page somewhere (ViewState). If you want jQuery based paging (client side) with partial rendering you need to handle client side onclick and add AJAX call to get new page based on pushed button.
i used jQuery plugin jquery.tablePagination.0.1.js for my solution
refer this link
As others have said, I don't think this is a good job for GridView. I'd take a look at ListView or Repeater as they are better suited for something like this and quite easy to add custom pagination to.

Categories

Resources