Edit individual datagrid cells using click event

Hi All,

I am developing a simple datagrid to store data with a status field.

the requirement is when ever user clicks that perticular cell in that Status column (any row in that column) the display control(label) will switch to dropdownlist with 3 options. user selects any one option and that value should update and replace the dropdownlist. Its kind of spreadsheet style editing....

how to handle this. i tried to use itemdatabound event. but couldn't succeed.

Please help me .



6/26/2008 3:30:33 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 37

 My recommendation would be to add into ItemTemplate for the "Status" column a LinkButton for the user to click databinding it's Text property to the db value you want.  In the server-side event handler for that LinkButton, change the GridView's EditIndex to the index of the row they just clicked.  Then in the EditItemTemplate for the "Status" column, add the DropDownList you mentioned, with it's SelectedValue databound also to the db value you want.  Set that DropDownList to AutoPostBack and in it's SelectedIndexChanged server-side event handler, call UpdateRow on your GridView and set the EditIndex back to -1 (so no row is being edited).  So basically it's the same as clicking "Edit" and "Update" on the GridView, except you're circumventing the user needing to click to do those things by doing them when they click the LInkButton and change the value in the DropDownList

Hope this helps!


"You shall love the LORD your God with all your heart and with all your soul and with all your might." - GOD
6/26/2008 7:49:08 PM

Thanks for your information. Certainly u r design will help with gridview.

but i am using Datagrid.


6/26/2008 7:56:04 PM

 Ahh... sorry I didn't notice that, and unfortunately I have no experience with the DataGrid.  That's .NET 1.1, right?

"You shall love the LORD your God with all your heart and with all your soul and with all your might." - GOD
6/26/2008 9:21:52 PM

Yes its 1.1 .NET

I want to use 2.0 only with Gridview. but unfortunately its certain to use existing code. so time being i am using the existing code for the demo purpose.


6/27/2008 6:25:43 PM

Similar Artilces:

using click event to change value used in form.load event?
Hi all. I need to use a value that is set in a button.click event, to create objects during page.load eventis that possible? Thanx for all help You can create objects in Button Click Event,As the Page_Load will fires first and then after the Button_Click event, when you click the button. Also you can use the sender property of the Page_Load Event. Hope this helps. - DeepakDon't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. Tha...

Edit the cell text by clicking in the cell in datagrid control
Sir,In asp.net 2.0 application, I want to edit the cell text by clicking in the cell in datagrid control. By EditItemTemplate it is possible to edit the cell text but for that we need to click on Edit button and after edit we need to click on Update button. But this way is not accepted. Is it possible in datagrid (possibly without activex control) to click in cell and edit the value and click out of the cell to update just like windows application grid?I did not find any article on web related to this.Please help me.Thanks in advance.    &nbs...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

How do I invoke the button's click event using using VB.Net
I am programming VB.Net for my ASP.net project. Can anyone tell me how do I code the "button" server control to invoke the click event? I believe one line of VB code would do. It didn't work when I try btnButton.Click() ???? Thank You! You can always call btnButton_Click(Me, EventArgs.Empty) If I remember correctly. This assumes you have a btnButton_Click(sender as Object, e as EventArgs) sub somewhere in your page. Greg You can also do btnButton_Click.PerformClick() !Jarod Sorry... Forget... The PerformClick method exist only for windows forms b...

hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

Problem in passing the cell value to a event handlar that will be called when the cell is clicked in a datagrid
hi,  this is my code , my need is to pass the valus of the cells in the first column to a event handlar method that will be called when the cells in the second column is clicked  I am struggling for ten days , Could you please tell me a solution? <asp:DataGrid ID="DataGrid2" DataKeyField ="Form Name" runat="server" ShowHeader="False" OnItemCommand ="DataGrid2_ItemCommand" OnPageIndexChanged ="Grd_frm_history_OnPageIndexChanged" OnItemDataBound ="DataGrid2_ItemDataBound" style="vertical-align: top; tex...

Edit datagrid cell by clicking?
 hey all,so I have this editable datagrid, with some bounded data, what I'm trying to do is to edit a cell of the data grid without using the edit button, and then maybe deselect the cell and it will automatically update. any ideas? Hi pxrage, Have a look at this article about creating an individual cell-edit GridView: http://www.codeproject.com/KB/webforms/EditGridviewCells.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....

Datagrid cell click event
I am attempting to figure out how to capture the click of a specific cell so that I can display a box for that cell for editing.  I do not want to edit the entire row.  I have seen lots of client-side JS that will let you display the cells value, but nothing that pushes back serverside. The proccess would be that you would click on a cell and an edit box would be displayed.  This would not display within the datagrid; instead, it would either be another window or perhaps a floating panel on the same page...  Once the change has been made, the data entered would be valida...

problem in binding a text box with datagrid at run time using web forms using C#
the code below is working properly. in this code 2 times(timeIn and timeOut) are subtracted and the result is bound to a datagrid(dbgMyGrid), what i want is that now the value (difference of both times) should also bound with a textbox control.  or inspite of binnding the SQl Squery result with datagrid(dbgMyGrid) it should directly bound to a textbox. Any of the result is appraicated. this.lblEmpTimeOut.Text=DateTime.Now.ToShortTimeString();SqlConnection myConnection = new SqlConnection("server=WAHEED;uid=sa;pwd=waheed;database=HRMS_EMPLOYEE");SqlCommand myCommand = ne...

Datagrid(.net 1.1) to GridView(.net 2.0) and using the RowUpdating event how to extract the values from the controls.
Ok  This is the settings: I use a Viewgrid with only itemtemplate colums for example. <asp:TemplateField HeaderText="Test"><ItemTemplate><asp:Label id="LBL_Test" text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' runat="server" meta:resourcekey="LBL_TestResource1"></asp:Label></font></ItemTemplate> <EditItemTemplate><asp:TextBox ID="HDN_Test" Text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' Runat="server" meta:resourcekey="HDN_TestResource1" /></EditItemTemplate></asp:TemplateField>  The ...

can someone one give me difference between web form and mobile web form and which or where or when i'm using the forms?
thanks Marc Hi Marc, Based on my understanding, you want to know the differences between the ASP.NET web application and ASP.NET mobile web application. If I have misunderstood you, please feel free to let me know. The ASP.NET forms are used to develop the ASP.NET pages for desktop browsers and The ASP.NET mobile forms are used to develop the ASP.NET pages for mobile device browsers. When we create the ASP.NET mobile web forms pages, we can use nearly all the features of ASP.NET. But there are a couple of compatibility issues: Error Handling and Reporting. Tracing. Using Redi...

Help! Can anybody tell me if I can use Visual Studio.NET to develop Web application at my home using Windows XP Home Edition?
Can anybody tell me if I can use Visual Studio.NET to develop Web application at my home using Windows XP Home Edition? I downloaded Web Martrix. But I don't want to use its IDE. I just want to use its webserver because Home Edition can't have IIS. Thanks.HeiGe Visual Studio.NET neededs IIS, But in home addition you can't use IIS. So in XPHome you can't use Visual Studio.NET from ASP.NET development!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti Thanks for your answer. But I have successfully added IIS to my XP Home. Special thanks to Holeinone, Pippo a...

I use DataGird_ItemCreated Events and a droplist to DataGrid Cell,but I cann't let the droplist have a initial value , even I use SelectedValue property or SelectedIndex property
I use DataGird_ItemCreated Events and a droplist to DataGrid Cell,but I cann't let the droplist have a initial value , even I use SelectedValue property or SelectedIndex property protected void dgMain_ItemCreated( Object sender, DataGridItemEventArgs e) { if( e.Item.ItemType == ListItemType.EditItem) { DropDownList ddlPermissionCategory = new DropDownList() ; ddlPermissionCategory.ID = "ddlPermissionCategory" ; ddlPermissionCategory.DataSource = Business.AccountsTool.GetCategoryList() ; ddlPermissionCategory.DataTextField = &q...

DataGrid cell click event #2
Hi, I have two problems with datagrid. These are - 1. I am fetching data from database and getting it in a dataset. In the time of display in a datagrid I want to display each row of dataset as a column in the datagrid. How can I do so? 2. In the datagrid, I want to write a click event on every cell click. In that click event I need to know exactly which cell was clicked (may be with row and column number). Please help me. Thanks in advance. Angshujit  create a separate table with the rows which yiu have as columns and bind the rows using for loop. Cheers,Achutha Krishnan~ No on...

Web resources about - Edit individual datagrid cells using click event - asp.net.web-forms

Gymnastics at the 2012 Summer Olympics – Women's artistic individual all-around - Wikipedia, the free ...
... go through to the Team final, where three team members compete on each apparatus. Teams are ranked on their total score. The best 24 individual ...

Review: He Named me Malala shows campaigner for female education as a remarkable individual
Pashtun teenager, who has become a symbol of collective feelings much bigger than herself, has paid great price for beliefs.

The nature of the individual market, games and SEP
The individual insurance market in the United States has always been a funny beast. One part of the market has always been a market for long ...

FAA drone task force recommends registration for pilots, not individual drones
If the FAA accepts the task force recommendations, registration will be mandatory prior to the operation of any UAS weighing more than half a ...

Congressmen Move To Protect Silicon Valley, But Ignore Individual Privacy
Congressmen Move To Protect Silicon Valley, But Ignore Individual Privacy

Culture: at the intersection of organizations, individuals, and the broader environmental context
... misconception about culture is that culture is determined either by the organization’s beliefs, values, and assumptions, or by the individual ...

9 Disappearing Individual Income Tax Breaks
9 Disappearing Individual Income Tax Breaks

Feds to require shelters to accommodate transgender individuals
Feds to require shelters to accommodate transgender individuals

Individuals on FBI???s Terrorist Watchlist Allowed to Purchase Firearms
Individuals on FBI???s Terrorist Watchlist Allowed to Purchase Firearms

Bombshell: United Healthcare may exit individual insurance exchanges after 2016
... keep your insurance carrier. The nation’s largest provider of health insurance announced this morning that it may choose to stop offering individual ...

Resources last updated: 12/11/2015 5:42:31 PM