473,385 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Editable data grid

Hi,

I am trying to implement an editable datagrid in .net 2005

This is how my grid is defined:

<asp:DataGrid runat="server" id="dgUser"
Font-Name="Verdana" Font-Size="9pt" CellPadding="5"
AlternatingItemStyle-BackColor="#dddddd"
AutoGenerateColumns="False" DataKeyField="UserId"
OnEditCommand="dgUser_EditRow">

<HeaderStyle BackColor="Navy" ForeColor="White" Font-Size="13pt"
Font-Bold="True" HorizontalAlign="Center" />

<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" HeaderText="Edit"
EditText="Edit" UpdateText="Update" CancelText="Cancel" />
<asp:BoundColumn DataField="UserId" HeaderText="Id" />

<asp:BoundColumn DataField="URole" HeaderText="Role" />
<asp:BoundColumn DataField="Fname" HeaderText="First" />
<asp:BoundColumn DataField="Mname" HeaderText="Middle" />
<asp:BoundColumn DataField="Lname" HeaderText="Last" />
<asp:BoundColumn DataField="StreetAddr" HeaderText="Street" />
<asp:BoundColumn DataField="AptNo" HeaderText="Apt #" />
<asp:BoundColumn DataField="City" HeaderText="City" />
<asp:BoundColumn DataField="State" HeaderText="State" />
<asp:BoundColumn DataField="Zipcode" HeaderText="Zip" />
<asp:BoundColumn DataField="Country" HeaderText="Country" />
<asp:BoundColumn DataField="PhoneNo" HeaderText="Phone #" />
<asp:BoundColumn DataField="EmailId" HeaderText="Email" />
</Columns>

</asp:DataGrid>


And following is the event I am calling on click event of the edit button in grid



protected void dgUser_EditRow(object source, DataGridCommandEventArgs e)
{

dgUser.EditItemIndex = e.Item.ItemIndex;
dgUser.DataBind();
}


somehow its not giving me anything on pressing edit.

Do I have to put any hidden text box controls and make them visible when edit button is clicked?

Can anyone help me on this ?
Apr 20 '07 #1
1 1400
Thanks to all. Problem solved with gridview control ..lol

Hi,

I am trying to implement an editable datagrid in .net 2005

This is how my grid is defined:

<asp:DataGrid runat="server" id="dgUser"
Font-Name="Verdana" Font-Size="9pt" CellPadding="5"
AlternatingItemStyle-BackColor="#dddddd"
AutoGenerateColumns="False" DataKeyField="UserId"
OnEditCommand="dgUser_EditRow">

<HeaderStyle BackColor="Navy" ForeColor="White" Font-Size="13pt"
Font-Bold="True" HorizontalAlign="Center" />

<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" HeaderText="Edit"
EditText="Edit" UpdateText="Update" CancelText="Cancel" />
<asp:BoundColumn DataField="UserId" HeaderText="Id" />

<asp:BoundColumn DataField="URole" HeaderText="Role" />
<asp:BoundColumn DataField="Fname" HeaderText="First" />
<asp:BoundColumn DataField="Mname" HeaderText="Middle" />
<asp:BoundColumn DataField="Lname" HeaderText="Last" />
<asp:BoundColumn DataField="StreetAddr" HeaderText="Street" />
<asp:BoundColumn DataField="AptNo" HeaderText="Apt #" />
<asp:BoundColumn DataField="City" HeaderText="City" />
<asp:BoundColumn DataField="State" HeaderText="State" />
<asp:BoundColumn DataField="Zipcode" HeaderText="Zip" />
<asp:BoundColumn DataField="Country" HeaderText="Country" />
<asp:BoundColumn DataField="PhoneNo" HeaderText="Phone #" />
<asp:BoundColumn DataField="EmailId" HeaderText="Email" />
</Columns>

</asp:DataGrid>


And following is the event I am calling on click event of the edit button in grid



protected void dgUser_EditRow(object source, DataGridCommandEventArgs e)
{

dgUser.EditItemIndex = e.Item.ItemIndex;
dgUser.DataBind();
}


somehow its not giving me anything on pressing edit.

Do I have to put any hidden text box controls and make them visible when edit button is clicked?

Can anyone help me on this ?
Apr 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Venkat Chellam | last post by:
I have a webgrid in my asp.net application. Data is a grid is loaded from the database. There is edit/cancel update column to the edit the current row. When i click edit, the row becomes editable...
1
by: atif | last post by:
i m using webmatrix n i hav a prob with editable data grid. i hav set the data grid with to 100% when i load the page the data grid fits into the screen 100%. but when i clicked on add new or on...
8
by: pmud | last post by:
Hi, I have 2 questions: 1. I have an editable data grid with 21 columns. I need to edit only 2 cloumns in this data grid. But when the grid is displayed in Edit mode, all the columns show long...
1
by: JMann101 | last post by:
I am writing a ASP.NET(VB) application and am having some trouble. I have a datagrid which list users and when an admin clicks "edit" a defined column becomes visible and a dynamic listbox control...
7
by: Diane | last post by:
Hi- I've been struggling with this problem and none of the fixes posted seem to help out at all. Yet, it seems like such a simple problem... I have a DataGrid, and load it up with data on...
2
by: Frank | last post by:
Hello, I am developing with VS.Net 2003 on the asp 1.1 platform. I am a few days new to using a datagrid. I found a nice tutorial and had no problems using an editable datagrid with textboxes...
1
by: Joe Spears | last post by:
Hi I want to display a datagrid summary of a datatable. The grid will not show all the fields, but when the user selects a row, I want the other controls (text boxes) to also bind to the same row...
2
by: dba56 | last post by:
In an ASP.Net 2.0 page using SQL Server 2K, I have a editable gridview that is bound to a SQLDataSource using stored procedures for its select and update queries. The grid works fine but is slow...
1
by: kithir | last post by:
Hi, I am working with asp.net.In my webform i have an editable datagrid.I am loading data from the database.I want to enter data for the particular column of the grid.But that grid has more than...
0
by: mirin | last post by:
Hello, In a Default.aspx page, I need to display an unbound grid with the following editable columns: Name, Location, Phone, Paid, Amount Initially the grid would be empty with only the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.