.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

GridView editing without using data source controls?

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net

I am binding my gridview without using a datasource control and instead doing it in the code behind. However, I would like to use the inline editing features of the gridview. Could someone please point me to an example that does gridview editing/updating 'manually' in the code behind?


View Complete Post

More Related Resource Links

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.

Data Points: Data Source Controls in ASP.NET 2.0


ASP. NET 2. 0 introduces a series of new tools that improve data access including several data source and data bound controls. The new assortment of data source controls can eliminate a ton of repetitive code that was required in ASP.

John Papa

MSDN Magazine January 2005

RowCommand returns null value for controls which are not binded to Gridview source


I am tryting to reach controls in the gridview rows by RowCommand event. I can take values of controls which are binded to gridview source successfully . But for all other controls which is not binded to gridview returns NULL value. All controls run at server. Why is that?

error when testing query during configuring sql data source for gridview


I got the following error message:

There was an error executing the query. Please check the syntax of hte the command and if present, the types and values of the parameters and ensure they are correct.  Failed to enable constraints.  One or more rows contain values violating non-null, unique, or foreign-key constraints.

But when I run the query through Management Studio, I can get the result. 

There are no parameters for this query either. 

Can anybody give me a glue what to check?


Find and Set DetailsView Controls In Empty Data Template in Gridview



I would like to find controls in the detailsview control placed in the EmptyData Template of the gridview.   I am trying to create Insert new record for the gridview control.

1. If there are existing records in the table - works fine and sets my two values:
 placed Detailsview and Insert Button in the footer of the gridview.  I needed to set the values of two fields.  When I click on the Insert button it saves new record and sets the field with the value (code attached - works fine).  I also have a popup extender that opens detailsview - this works just fine.

2, If ther are not records in the table - saves record but cannot find and set controls on the detailsview
Same thing setup in the EmptyData Template.  The record is saved but I cannot Find and set the field value on the control.

Here is code:

1.  Link button (on click) in the gridview footer (works fine)

protected void LinkButton1_Click1(object sender, EventArgs e)


        string zupa1;

        zupa1 = ddlSelectEmployee.SelectedValue;





Difference between typed dataset and data source controls...?


Hi all DotNeters,

I'm new to this community and got newbie question, briefly in data access in asp.net what is the difference between accessing dataset using typed Dataset and using data sources controls like SQL data source control .?

 As I noticed that using data source controls is much easier, but it allows only one data access method i.e. only one query. am I right with that..

Best regards.

editing gridview values to another pages controls


i have a gridview in one form showempdetails.aspx

and another form is to edit the value of selected row editempdetails.aspx

in this page i have textboxes and dropdowns.

im using querystring which is bringing empid

(eg: empid=1 should bind all other columns to my controls of editempdetails.aspx)


below code is of empedit.aspx this takes loginid to employees_add.aspx

grdEmployeesEdit.EditIndex = e.NewEditIndex;

        Label objEmp = (Label)grdEmployeesEdit.Rows[e.NewEditIndex].Cells[0].FindControl("lbl_loginid");
        string id = objEmp.Text.ToString();
        Response.Redirect("~/Employee/employees_add.aspx?loginid=" + id.ToString());

employees_add.aspx.cs i wrote below code

string qslogin = Request.QueryString["loginid"];
        qslogin=objEmployee.P_loginid;//objemployee is my business logic

here by using primary key i should pass all my values of previous selected

SharePoint Designer crashing when editing Data Source

Environment is SPD SP1, WSSv3 SP1 + Infrastructure Update

When I add a datasource (e.g. insert the datasource of one list into the NewForm.aspx of another list), I can configure what fields, sorting, filtering, etc.  It adds correctly.  I then add my Data View DropDownList to the form.  When I go back and look at my datasource (spdatasource1), the bottom two dropdowns are blank.

If I attempt to configure the datasource, I get the following error:

Error invoking 'Configure Data Source...'.  Details:
Exception has been thrown by the target of an invocation.

SPD then crashes.  This is preventing me from really adding any new datasources as the new datasources essentially get added unconfigured, even though I went through the proess of configuring them.

Problem signature:

Problem Event Name: APPCRASH

Application Name: SPDESIGN.EXE

Application Version: 12.0.6211.1000

Application Timestamp: 46d4b150

Fault Module Name: ntdll.dll

Fault Module Version: 6.0.6001.18000

Fault Module Timestamp: 4791a783

Exception Code: c0150010

Exception Offset: 0005b84e

OS Version: 6.0.6001.

Locale ID: 1033


Set a data source for DropDown List inside GridView


How do i set a data source of  a drop down list which is inside a grid view, snap shot of asp code given below , the Asp file name is DataEntry.aspx and there is method in the DataEntry.aspx.cs called DTB.BindData("Department"). i want to set the datasource to point to this method


<asp:GridView ID="GridViewEmply"  DataKeyNames="EmployeeID" runat="server"
 AutoGenerateEditButton="True" ShowFooter="True"
OnRowEditing =  "GridViewEmply_RowEdit" OnRowCancelingEdit = "GridViewEmply_RowCancelingEdit"
OnRowUpdating = "GridViewEmply_RowUpdating"  OnRowCommand = "GridViewEmply_RowCommand"
AllowSorting="True" AutoGenerateColumns="False" AllowPaging="True"  Visible="false">
<asp:TemplateField HeaderText="DepartmentName">
<asp:Label ID="LabelEmplyDeptName" Text='<%# Eval("DepartmentName") %>' runat="server"></asp:Label>
<asp:DropDownList ID="ddlDept" runat="server" >

Enabling editing on dataview created from linked data source



I'm working with MOSS 2007. Created a linked data source using 2 custom lists in the site and created a dataview. One of the columns shows a joined subview of the 2nd list from the linked data source. I'd like to enable the editing option (edit, insert) for this joined subview, but that option seems to be disabled (grayed out). In fact, the editing option is disabled for the main dataview as well.

Has anyone done something similar to this? Please advise.





Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How Do I Enable Inline GridView Editing?

Now that you have created a site with Edit and Details views, how do you enable inline editing in a GridView control? This video shows you how, and also touches on routing.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Display data in gridview dynamicallay

I have AD domain which has 100000 users, I want to display all the users in gridview controls.Actually it is displaying users in gridview after parsing entire domain which takes around 30 min. I want to display the users while loading itself.It is continously getting user information from AD domain and getting each user details, I want to display the users information which already queried instead of waiting till getting all users information

asp.net display data in gridview

i want to display data in gridview binded to a sql datasource
but the problem part is i want to bind a field of that datasource to a dropdownlist and when a item is selected in that dropdownlist then correcposnding to that data will be displayed in gridview...

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend