Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 3rd, 2008, 12:11 AM
Authorized User
 
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview with only one row

I got a gridview with template fields.The first field is a dropdown list and second one is a label and third and 4th fields the user need to enter.After the enter button is pressed on the last field a new row is to be created with ddlist filled from the database.So my question is how can we make a gridview contain only one row in page load...

AMR
  #2 (permalink)  
Old March 3rd, 2008, 09:19 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Set the PageSize attribute to 1.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
  #3 (permalink)  
Old March 3rd, 2008, 12:37 PM
Authorized User
 
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dear friend,

I am not able to sort it out even i give that attribute 1...

AMR
  #4 (permalink)  
Old March 3rd, 2008, 12:54 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Something like this should work:

if(!Page.IsPostBack)
{
    gv.PageSize = 1;
    gv.DataSource = <datasource>;
    gv.DataBind();
}

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
  #5 (permalink)  
Old March 4th, 2008, 11:00 PM
Authorized User
 
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dear parson,
its not working parson.The thing is I got 3 records in database and the grid is displaying 3 records eventhou i give pagesize attribute as 1.and the three textboxes are not from the database.they are not databound...

AMR
  #6 (permalink)  
Old March 5th, 2008, 09:27 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Then why are your controls even in the GridView at all? The generated GridView is based soley off of values that are provided from controls that do not need to be connected to the datasource. Why not move these controls out of the gridview all together?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView - Skipping a Row gothael ASP.NET 2.0 Basics 1 July 18th, 2008 10:02 AM
Gridview with only one row mallikalapati ASP.NET 2.0 Professional 0 February 25th, 2008 06:46 AM
Getting a GridView Row to highlight gcm_uk ASP.NET 2.0 Basics 0 May 1st, 2007 05:55 AM
Getting Data from selected row in gridview JoinTTT ASP.NET 2.0 Professional 3 April 17th, 2007 02:14 AM
GridView and Row Index itwebguy .NET Framework 2.0 1 October 16th, 2006 04:18 PM



All times are GMT -4. The time now is 01:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.