Solved

Number of Rows to display

Posted on 2011-09-29
13
280 Views
Last Modified: 2012-05-12
Is it possible to control the number of Gridview or table rows ?
I have an input textbox which I would type a number. for example if I type 5, the Gridview would adjust and dynamically display 5 rows.

In the Gridview, I have added itememplatefield and d placed textboxes and dropdowns in several cells on same row. Is it possible add  the number ROW with the predesigned controls in teh cells display\ too
when the appropraite number rows are defined in the textbox
0
Comment
Question by:zachvaldez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
13 Comments
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 250 total points
ID: 36886879
Yes it is possible.
1) Add onchange event to textbox and autopostback property to true like
 <asp:TextBox
        id="txtSearch"
        AutoPostBack="true"
        OnTextChanged="txtSearch_TextChanged"
        Runat="server" />

2) In txtSearch_TextChanged event

 protected void txtSearch_TextChanged(object sender, EventArgs e)
    {
       gv1.PageSize= e.NewPageSize;
       gv1.PageIndex = 0;
       // Add code to bind grid e.g gv1.DataSouce = ..; and gv1.DataBind();
    }
 
0
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 250 total points
ID: 36887346
0
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 250 total points
ID: 36888287
Some modification in above code

protected void txtSize_TextChanged(object sender, EventArgs e)
    {
       gv1.PageSize= Convert.toString(txtSize.Text); // Size from your textbox
       gv1.PageIndex = 0;
       // Add code to bind grid e.g gv1.DataSouce = ..; and gv1.DataBind();
    }
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:zachvaldez
ID: 36889947
How you handle dropdowlist that are prepopulated.
0
 

Author Comment

by:zachvaldez
ID: 36901338
What I mean here is that I have a textbox where I can input a number. That number will determine the number of Gridview rows which is produce when a buton is clicked.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36906177
>That number will determine the number of Gridview rows which is produce when a buton is clicked.

Is that the number of rows in a page or the number of empty rows added to the grid?
0
 

Author Comment

by:zachvaldez
ID: 36906259
Empty rows. The point and I know u have ideas is to limit and exact the rows for data entry and not exceed it. For ex.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36906360
As I said in other question, I am not aware of a way of adding empty rows in gridview directly.
0
 

Author Comment

by:zachvaldez
ID: 36906556
So can't do something like
Grdview2.(cell,row)
= textbox1.text..not exactly correct syntax
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36906710
Not if the cell at the row and column does not exist already.
0
 

Author Comment

by:zachvaldez
ID: 36907034
How about if you have textboxes inside the Griview's cells?
Is it not possible to find the control and assigned the textbox for firstname... textbox  then then column textbox ... for lastname textbox.. something like that> What requirnments needed for that to happen?
0
 

Author Comment

by:zachvaldez
ID: 36909468
I saw someone use the
'Empty Data 'Template and even
Added Insert,Delete capabilities but I'll have to check it out.Interesting.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36912253
What are you trying to achieve, can you show us a screenshot?
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question