Using PageTemplate to have a row used to add new rows to the datasource

I read in the Programming Microsoft ASP.NET 2.0 book that you can use the PagerTemplate to have an "extra" row used to add new rows to the datasource bound to the GridView.  Unfortuantely, it does not show how.

I am trying to do this and I am having a problem where the Pager row is not showing up.

I have defined a template:

<PagerTemplate>
   <table width="100%">
     <tr>
       <td><asp:LinkButton ID="btnAddFMEff" runat="server" Text="Add" CommandName="Add" /></td>
       <td style="width: 80%;"><asp:TextBox ID="txtNewEffect" runat="server" Width="99%"/></td>
       <td style="width: 10%;"><asp:TextBox ID="txtNewSev" runat="server" Width="99%"/></td>
     </tr>
   </table>
</PagerTemplate>
 And I have set the AllowPaging gridview property to true.  The Pager row shows up fine in the design view but it won't show up during runtime.  What am I missing?
0
CHolt
1/5/2007 2:41:48 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1413 Views

Similar Articles

[PageSpeed] 37
Get it on Google Play
Get it on Apple App Store

I'm wondering if they are referring to use footer template? Here is an example of that technique

http://geekswithblogs.net/casualjim/articles/51360.aspx

http://www.gridviewguy.com/ArticleDetails.aspx?articleID=98


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
1/5/2007 3:22:01 PM

I double checked and it says that using the PagerTemplate is the easier way in ASP.NET 2.0 because it actually has a template.  However, I am aware of modifying the footer also.

I found out what my problem was.  The pager row was being hidden because there were not any "pages" needed in my datasource.  To fix this I did the following:

 

protected void grdEditEffects_DataBound(object sender, EventArgs e)
        {
        GridView grdEditEffects = (GridView)sender;
        if(grdEditEffects.BottomPagerRow != null)
            grdEditEffects.BottomPagerRow.Visible = true;
        }

 Now it displays and works as expected.

Thanks.

0
CHolt
1/5/2007 3:49:33 PM
Reply:

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

How to add a new row into gridview using Objectdatasource control
Hi, I am binding data into the gridview using objectdatasource control. I am able to perform the update and the delete functionality. But I need to insert a new row into the gridview and then somehow wire up the objectdatasource control to do the insert routine for me. I am using business logic layer plus the dataaccess layer along with stored procedures to achieve the above. Can some one tell me how to perform the insert routine? Hi guyind, It is no matter which datasource control you use, ObjectDataSource or SqlDataSource. You can set InsertMethod into ObjectDataSource to insert a new r...

Add New Row To DataGrid Using the Footer With a DropDownList Control
I am trying to discover the best method for adding a new row of data to a datagrid. My datagrid is bound to an SQL Server table. I was reading the article "Adding a New Record to the Datagrid", by John Sanborn (4GuysFromRolla.com) wherein he suggests a method of using the datagrid's footer for adding new records. The concept works if each column of data is to be keyed in by the user, but I have a requirement to provide a drop-down list of valid values for a specific column. I've been tinkering with using a drop-down list in the footer of the grid, but I am unable get it to displ...

superreview requested: [Bug 420726] Use system background color for odd tree rows : [Attachment 308904] New version, use system bg color on odd rows
Stefan <stefanh@bluebottle.com> has asked Robert O'Callahan (:roc) <roc@ocallahan.org> for superreview: Bug 420726: Use system background color for odd tree rows https://bugzilla.mozilla.org/show_bug.cgi?id=420726 Attachment 308904: New version, use system bg color on odd rows https://bugzilla.mozilla.org/attachment.cgi?id=308904&action=edit ------- Additional Comments from Stefan <stefanh@bluebottle.com> I surely need sr as well. ...

superreview granted: [Bug 420726] Use system background color for odd tree rows : [Attachment 308904] New version, use system bg color on odd rows
Robert O'Callahan (:roc) <roc@ocallahan.org> has granted Stefan <stefanh@bluebottle.com>'s request for superreview: Bug 420726: Use system background color for odd tree rows https://bugzilla.mozilla.org/show_bug.cgi?id=420726 Attachment 308904: New version, use system bg color on odd rows https://bugzilla.mozilla.org/attachment.cgi?id=308904&action=edit ------- Additional Comments from Robert O'Callahan (:roc) <roc@ocallahan.org> Why not make this -moz-oddrowbackground? I seem to recall GTK2 could use this. You just have to rename things, GTK2 supp...

get the row element values using row index for dynamic dropdownlist using javascript
Friends,How to get the row element values using row index for dynamic dropdownlist using javascript ?Thanks in advance  I want creating dynamic dropdownlist  using javascript. I am working on deleting a row. function DeleteRow(r) { var i = r.parentNode.parentNode.rowIndex;document.getElementById("ctl_Contentmain_tbldynamic").deleteRow(i);var str = document.getElementByName("ddljobs");   alert(str); } Check out this. var str = document.getElementById('<%=ddljobs.ClientID%>');   Thanks,santosh_maharajaPlease mark as answer ...

To add a new row to the datagrid using javascript
Hi all can anbody help me how to add a new row to the existing datagrid You have to use ajax or server side code to add data into database. Javascript is a client side scripting language.Please refer bellow links..1) http://www.codeproject.com/KB/webforms/DataGridInsert.aspx2) http://www.daniweb.com/forums/thread72925.html Maulik PatelMCTS, Software EngineerDon't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy. Yes ur right i am using client callback ...

How to add a new row in GridView of using SQLDataBound
I using GridView to show the SQL statment result. I want add a text in each row. example: col1         col2         col3ABC         1              1DEF         2              2 Change to: col1         col2         col3 ...

How to Add new rows in gridview using ajax toolkit
hey friends i m working on gridview i m using updatepanel and scriptmanagerif anyone knows how can we add plz tell me   ANKIT SHAH Hi ANKIT SHAH, Based on my understanding, what you want to do is to add new rows in GridView using AJAX ScriptManager and UpdatePanel. To achieve your goal, please refer to this code: TestForm.aspx <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:UpdatePanel ID="...

How to add new row to gridview using code behind
Hi,  I have a gridview and a "button" control, when i click on the button, i want to add new row to a gridview.  the gridview got 3 columns.  Inside the 1st column is label, 2nd column is textbox and the 3rd column is also a textbox.  I want added new row where each of column have textbox in it.  So when i click the submit form button, i will read the gridview record, and pump into the database.  It would be more appreciated if the code is writen in vb code behind.  Most of the sample on the internet all writen in javascript, and the control is...

To add a check box at front of row, which control should be use?
 To add a check box at front of row, which control should be use?    Hey aspfun,Please, use this : <asp:TemplateField> <EditItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </EditItemTemplate> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </ItemTemplate> </asp:TemplateField> But If you want to use it temp. add it @GridView_RowDataBound     Please, let me know if that helped .. Best Regards .. Please, “Mark as Answer” the post that he...

Add Rows to a GridView Without Using DataSource (programatically)
Hi All, I have a GridView which must contain client selections but I don't want to save it to database until the client has finished selecting and then save it. Does anybody know how to add rows with data programatically ? (it would be much better if the solution does not post to the server like ajax, but I can live with posting), I have read other posts with the same problem but they have unsolved answers.   Thanks in advance.  George This is exact what I did right now. You can use javascript to add it. <FooterTemplate> <input type="button"...

using ddl with gridview trying to add insert new row
i'm using a ddl to populate a gridview and trying to use formview in the empty data template to be able to insert new rows in the table.... the problem is that when i click the insert link the formview doesn't come up Hope someone can help me outjohn     1 "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="menu.update3.aspx.cs" Inherits="_Default" %> 3 <html di...

What control do I use (or do I not use a control at all...)
Okay so here's the story so far. I am making a blog to be incorporated into a website. Well, I'm doing the blog from scratch. I'm using MySQL to source all the data via MySQL .NET/Connector. Now while developing the script, I used DataReader and Response.Write to show the blog topics. Now that it has come to put it under a design (I'm using a Master Page for that), I've hit the problem. Response.Write shows all the topics before any of the design elements could be incorporated. So that (more or less) is out of question. So next I looked into the data presentation controls. I looked up GridVi...

Web resources about - Using PageTemplate to have a row used to add new rows to the datasource - asp.net.presentation-controls

Astrologer - Wikipedia, the free encyclopedia
An astrologer practices one or more forms of astrology . Typically an astrologer draws a horoscope for the time of an event, such as a person's ...

Write a Review – Abstract Politics
[pagetemplate]write_a_summary[/pagetemplate]... From AbstractPolitics.com: Precis of political books and articles.

Website errors corrupt marketing efforts from within
The shockingly high level of errors on large-company websites points towards immature web governance processes and a general over-reliance on ...

绾界害/娉㈡柉椤垮浗闄呴绉戝ぇ瀛?甯冭幈涓佸闄闄㈡牎浠嬬粛_娴峰闄㈡牎_婢抽檯鍑哄浗鐣欏 PageTemplate 绾界害/娉㈡柉椤垮浗闄呴绉戝ぇ瀛?甯冭幈涓佸闄?
鍖椾含 VIP 澶╂触 澶師 鍐呰挋 娌堥槼 闀挎槬 澶ц繛 鍝堝皵婊?/a> 涓婃捣 鍗椾含 鏉窞 娓╁窞 鍚堣偉 鍘﹂棬 鍗楁槍 娴庡崡 闈掑矝 閮戝窞 姝︽眽 闀挎矙 閲嶅簡 鎴愰兘 鏄嗘槑 瑗垮畨 鍏板窞 鏂扮枂 骞垮窞 娣卞湷 鍗楀畞 鐭冲搴?/a> 澧冨涓績 ...

Next - Store Profile - Manchester Arndale
/Templates/PageTemplates/Manchester%20Arndale/MA2012/gfx/favicon.ico" /> Free WiFi in-centre Register Share Facebook Twitter YouTube The Centre ...

TiddlyFolio - Your Wiki Wallet v1.0 for Firefox
{{menubox{{{big{You can extend the abilities of ~TiddlyWiki to further customize your content to suit your needs, simply by adding extra tiddlers ...

My TiddlyWiki - a reusable non-linear personal web notebook
This tiddler shows some more complex effects that can be obtained with cunning use of CSS. Not all of these will work properly on all browsers ...

TitleIndex – Transmission
Search: Login Help/Guide About Trac Preferences Register Wiki Timeline Roadmap Browse Source View Tickets Search wiki: TitleIndex Context Navigation ...

Bob Stepno's Other Journalism Weblog
Luckily, on the big printed page the large pictures of horses probably saved the blood pressure of any "save our swamps" activists. (For horse ...

Breakdowns - Push cx
When Jim asked me how many hours I could put to So Play We All this week, I said “Negative three”. That turned out to be pretty accurate, as ...

Resources last updated: 11/30/2015 2:14:02 AM