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?
-1
guyind
3/1/2009 10:34:39 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1612 Views

Similar Articles

[PageSpeed] 5

Hi guyind,

It is no matter which datasource control you use, ObjectDataSource or SqlDataSource. You can set InsertMethod into ObjectDataSource to insert a new row into GridView (add into data source such as table and bind the data source to GridView). You can add TextBoxes or other entry controls in the FooterTemplate of GridView. Here is a very good sample about adding new row into GridView using ObjectDataSource:

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

Thanks,


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Qin
3/5/2009 7:10:19 AM
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 ...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

using controlS to control a gridview
This question is probably posted but i did not bother to look at 10,000+ posts so i am sorry. I've seen the tutorial where he builds a dataset and uses a gridview and controls the gridview with the drop down list box. What i am trying to do is to control the gridview with 2 drop down list boxes. First select the Country you life in and then the State. I've looked at the grid view properties but couldn't find where i can add another parameter. Is it possible to control a grid view (or any form of displaying the information) with more than 1 controller? Thank You.  ...

Using Data Controls Without Using ObjectDataSource Control
Hi, I've been looking on the Internet for a tutorial that would show me how to use the data conrols (FormView, GridView etc) without using an ObjectDataSource (or any other data source control).  The reason is that I want to use a formview and gridview from within another formview control to create a single form  that would allow me to insert, update and delete an order and its order details at the same time. I thought that this could be achieved by having a DataSet containing two DataTable objects in the code-behind with the Order DataTable containing one row to repres...

Problem in Using DropDownList Control to select a selected row of SqlDataSource that is under GridView Control
Hi all,In my SQL Server Management Studio Express, I have a database "ChemDatabase" that has a table "LabData"  formatted in the following way: SampleID int PRIMARY KEY, SampleName nvarchar(25), ChemicalName, nvarchar(25), Concentration decimal(6.2) with 5 rows of records in this .dbo table. In my Visual Web Developer Express, I created a website "RPD-TCE" for extracting a row of record from the LabData table by using a DropDownList, a GridView and a SqlDataSource.  I want to click DropDownList to list one number of S...

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...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

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...

Programatically addding controls to GRidView Control
Hi , I am trying to add a template field (image button and calender control) both in one data cell of a Grid View. Initially my image button is visible and calender is invisible. And I want to make calender visible and image invisible once I click on image . But When I click on image it does not show image and calender both. When I checked in debug mode none of the controls are getting added to the desired cell. I am not sure why the controls are not getting added. I have kept the DataControlRowState in Edit mode. Any help would be highly appreciated. Regards, VB...

problem to delete row in datatable where gridview used to display info for add to cart control
Hi, I want to be able to delete any row from my cart. Each row will have a delete button next to it. I have a gridview displaying my cart and am using a datatable in my code. I have had help to get this far but have now been left with a hint of how to proceed but am not sure how exactly to proceed. I hope someone can help me please. my gridview is as follows,  <asp:GridView AutoGenerateColumns="False" ID="GridView1" runat="server">        <Columns>       &n...

this.Controls.Add does not add control to child collection (this.Controls.Count == 0)
Ok, as silly as it may sound, I have a situation where I am creating a CompositeControl in ASP.NET 2.0, C#. I have the following code in the CreateChildControls() method that build the control's child control collection: 1    for (int i = 0; i < _menus.Count; i++)2    this.Controls.Add(_menus[i]);3    4    foreach (FloatingMenu menu in _menus)5    {6    Label lbl = new Label();7    lbl.ID = string.Concat("GroupQ", menu.ID);8    lbl.CssClass = "menuIt...

Issue with getting values from child controls in a gridview, to use for the update using a SQLDataSource control
Hi all, I have a gridview bound with a SQLDataSource. I am using the Update feature of the SQLDataSource to update a SQL Server database with values entered into the gridview. However I am not getting it to work. I believe this is due to the controls that contain the user entries are not the gridview itself, but rather child controls within the gridview. I have been using the names of the actual controls but nothing happens. Upon submit, the screen returns blank, and the database is not updated. Here is some code:   <asp:GridView ID="GridEditSettlement" runat="server" AutoGenerate...

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET- http://www.aspnetzone.de/blogs/peterbuch...

can we use gridview control with in repeater control
HI all,     Can i use gridview control with in repeater control, Any one knows plzzz... let me know. Is there any possibility for this?      It is urgent required... plzzzz... help me..  ------------- ThanksBalu Chandaka  yes you can nest a gridview control in the repeater controlJeev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~If you get the answer to your question, please mark it as the answer. Hi Jeev,    Thank you for your reply.But how can do that give some idea or If you have any example code snippet then plzzz... let m...

Web resources about - How to add a new row into gridview using Objectdatasource control - asp.net.presentation-controls

Forums Forums Database Error
This is a discussion forum powered by vBulletin. To find out about vBulletin, go to http://www.vbulletin.com/ .

Using The LINQDataSource
-*+There is a new datasource control available in Visual Studio that works in much the same way as the SQLDataSource and the ObjectDataSource. ...

ASP.NET Web Forms DynamicData FieldTemplates for DbGeography Spatial Types
... a FormView in ASP.NET Web Forms. Notice the ItemType is set, rather than using Eval(). We're also using SelectMethod rather than an ObjectDataSource. ...

LINQ Tutorials : LINQ Tutorials, Articles and Resources
Articles and Helpful Tutorials for LINQ and ASP.NET

About Mikesdotnetting
I started this site as somewhere to store answers to bits and pieces that I see asked frequently in the forums at www.asp.net . Rather than type ...

Runnable code for JQuery, Codeigniter, NodeJS, PHP, Python and more - Runnable
Runnable code for dart-vm, express, paypal, google, evernote, everyauth, ejs, rendr, CakePHP, php-mysql, php-facebook, codeigniter, imagemagick, ...

ASP.NET Pivot Table - RadPivotGrid for ASP.NET AJAX
... of all data reports. Try now! Use any declarative data source control (AccessDataSource, SqlDataSource, LinqDataSource, EntityDataSource, ObjectDataSource, ...

Miscellaneous « AJ\’s blog
AJ\’s blog January 28, 2012 2011 in review Filed under: Miscellaneous — ajdotnet @ 7:41 pm The WordPress.com stats helper monkeys prepared a ...

ObjectDataSource - Selectcount method with custom parameters and custom paging.
protected void obds_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { if (!e.ExecutingSelectCount) { e.InputParameters["filter"] ...

Archive
Archive - Forever Breathes The Lonely Word

Resources last updated: 12/15/2015 3:18:46 AM