Solved

populating and appending rows of a gridview

Posted on 2011-09-29
18
282 Views
Last Modified: 2012-05-12
I'd like to populate a gridview based on what's entered on textboxes
I have the following input entered in textboxes:
First name,last name,address,state,zip,phone..
What is required is to assign
Firstname to gridview row 1 cell,lastname to next cell,address to next column...then if next record is entered,it wiil append to next row in the grid...and same handling ,append next record
0
Comment
Question by:zachvaldez
  • 9
  • 6
  • 3
18 Comments
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 100 total points
Comment Utility
0
 

Author Comment

by:zachvaldez
Comment Utility
Would listview probably a better control to use as far as mapping the input controls such as textboxes and dropddownlists to specific cells in the row of the grid iew or Listview. How do you assigned the values in each individual cells in the row?
0
 
LVL 17

Expert Comment

by:sonawanekiran
Comment Utility
Have checked link?
In footer template there is empty row. and when you click on new record  then
GridView1.ShowFooter = true;
Here explained more better way

http://www.revenmerchantservices.com/page/gridview-add-new-row.aspx


0
 

Author Comment

by:zachvaldez
Comment Utility
What on last minute a row is decided to be removed?
0
 
LVL 17

Expert Comment

by:sonawanekiran
Comment Utility
Add linkbutton  "Cancel" near to "save" linkbutton
And onclick event of Cancel button
GridView1.ShowFooter = false;
0
 

Author Comment

by:zachvaldez
Comment Utility
Hi, You got excellent finds on those links. In one of the link. the example did not go into detail about the
'GridProvider.Getdata class'
0
 

Author Comment

by:zachvaldez
Comment Utility
Well, let me please clarify further.
The textboxes are in a form
and teh gridview is below the form...
In the form, I have fiirstname,lastname..etc
There is a buton 'Add Record'

When I click the button, Id like the values fromt eh textboxes form the form above it  inserted in the Gridviiew row...
then the form refreshes again... with no values displayed and Gridview displays the entry as a row.
So it is assigning values question. thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Are you using a DataTable as the datasource or a sqldatasource?
0
 

Author Comment

by:zachvaldez
Comment Utility
I think at that point of clicking the button,I am not committed or written anything to the table. I would just like to  display inthe gridview in one row the values from the textbox- first name,last name,eycetc..
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
I am not aware of a way of adding empty rows to gridview directly.
0
 

Author Comment

by:zachvaldez
Comment Utility
If it cannot be done, is it possible to have a form that have textboxes(input for Firstname,Lastname,etc...) and a button . This button will assigned the values from the form
to a Listview or gridview whichever is possible to take the input and display in there.
The form will just be use to inserting the records and bind to the :Listview or Gridview.?
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Why not use the grid itself to add records?

This code is in C# but it gives you an idea.

http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html
0
 

Author Comment

by:zachvaldez
Comment Utility
It would not be design-wise not applicable to y case because of so many textboxes for input unless the gridviw is designed like a form . Im not good in UI
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 150 total points
Comment Utility
0
 

Author Comment

by:zachvaldez
Comment Utility
hi, I actually saw and played with the last 2 links from codeproject. But because woth the large number of textboxes and are required with long info in it, entering them horizontally may not be enough space unless a clever way to do it discovered.. Great links adn they are enterprising as well.
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
You can have multiple textboxes on the same line. Use a table to arrange the entry form.
0
 

Author Comment

by:zachvaldez
Comment Utility
You mean in one column?
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
In one row. You can have

Firstname: textbox LastName: textbox

etc
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now