c# - Gridview Paging ASP.NET with Pager Panel outside Gridview -
This is my first time to use ASP.NET to develop a website.
The paging function and I data from the database in a GridView with can implement it using "How do I connect my pager (right down in the picture) to pager instead of gridview which is generated by ASP.net" Picture: < Img src = "https://www.dropbox.com/s/iq9cakm4pelge3i/25-Jul-14% 2010-42-30% 20 AM.png" alt = "image"> This is my code Spx code CS OnPageIndexChanging = "GridView1_PageIndexChanging" but the question I would like to use your pager so How can I
& lt; Asp: UpdatePanel ID = "Update Pencil 1" Runat = "Server" & gt; & Lt; ContentTemplate & gt; & Lt; Asp: GridView ID = "GridView1" runat = "server" AutoGenerateColumns = "false" CssClass = "Table Table bordered table dense table striped table primary table vertically-center is really" PageSize = "3" AllowPaging = "" OnPageIndexChanging = "GridView1_PageIndexChanging "& Gt; & Lt; Columns & gt; & Lt; ASP: Boundfield datedfield = "UNIT_ID" header text = "hundred" & lt; Header style CssClass = "center" /> & Lt; Item style width = "10%" CssClass = "center" /> & Lt; / ASP: BoundField & gt; & Lt; / Column & gt; & Lt; / ASP: GridView & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt;
public partial class _Default: Page {protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) bindGridView (); } Secure void bindGridView () {string sqltxt = "choose from drug_units"; // where UNIT_ID =: unitid "; CommandData com = new CommandData (); comm.SetCommandText (sqltxt); //comm.AddInputParameter("unitid", "5") & the list; lt; DrugsUnit & gt; DY = new list & lt; DrugsUnit & gt; (); comm.ExecuteNonQuery (); DY = comm.ExecuteToList & LT; DrugsUnit & gt; (); GridView1.DataSource = DY; / * BoundField boundField = new BoundField (); boundField.DataField = "UNIT_ID"; boundField.HeaderText = "ID"; boundField.SortExpression = "ID"; boundField.HeaderStyle.CssClass = "center"; boundField.ItemStyle.CssClass = "center"; GridView1.Columns.Add ( boundField); * / GridView1.DataBind (); GridView1.HeaderRow .TableSection = TableRowSection.TableHeader; bindGridView () ;;}}
protected void GridView_RowDataBound (object sender, GridViewRowEventArgs e) {if (e.Row.RowType == DataControlRowType.Pager) {upGridPager.Up date (); EkRowkSetRenderMethodDelegate (New RenderMethod ((R W,) = & gt; {e.Row.SetRenderMethodDelegate (zero), (var = new StringWriter (using MS)) (var writer = new HtmlTextWriter (MS)) using {e .Row.RenderControl (author); GridPager.InnerHtml = "& LT; tABLE & gt;" + ms.ToString () + '& lt; / tABLE & gt; ";}}));}
aspx (might look like out of your grid)
& lt; asp: UpdatePanel ID = "upGridPager" Rnat = "server" Apdetmod = "conditional" & gt; & LT; ContentTemplate & gt; & Lt; div runat = "server" id = "Gridprisht" / & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt;
Comments
Post a Comment