• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

populating and appending rows of a gridview

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
zachvaldez
Asked:
zachvaldez
  • 9
  • 6
  • 3
2 Solutions
 
sonawanekiranCommented:
0
 
zachvaldezAuthor Commented:
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
 
sonawanekiranCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
zachvaldezAuthor Commented:
What on last minute a row is decided to be removed?
0
 
sonawanekiranCommented:
Add linkbutton  "Cancel" near to "save" linkbutton
And onclick event of Cancel button
GridView1.ShowFooter = false;
0
 
zachvaldezAuthor Commented:
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
 
zachvaldezAuthor Commented:
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
 
CodeCruiserCommented:
Are you using a DataTable as the datasource or a sqldatasource?
0
 
zachvaldezAuthor Commented:
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
 
CodeCruiserCommented:
I am not aware of a way of adding empty rows to gridview directly.
0
 
zachvaldezAuthor Commented:
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
 
CodeCruiserCommented:
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
 
zachvaldezAuthor Commented:
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
 
zachvaldezAuthor Commented:
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
 
CodeCruiserCommented:
You can have multiple textboxes on the same line. Use a table to arrange the entry form.
0
 
zachvaldezAuthor Commented:
You mean in one column?
0
 
CodeCruiserCommented:
In one row. You can have

Firstname: textbox LastName: textbox

etc
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 9
  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now