473,769 Members | 3,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview: How change view to normal state after RowUpdating?

I have some custom rowupdating code in my gridview.

The user clicks edit, edits the record, clicks update and it runs my code.

The code runs fine but the row is still in an 'update' mode. How can I
change it back to 'normal' mode, as if they clicked cancel?

e.cancel = true doesnt seem to work.

Thanks.
Nov 19 '08 #1
4 6420
After you update the row, set the grid's edit index to -1 and rebind your grid.

GridView1.EditI ndex = -1;
GridView1.Bind( );

"Bobby Edward" wrote:
I have some custom rowupdating code in my gridview.

The user clicks edit, edits the record, clicks update and it runs my code.

The code runs fine but the row is still in an 'update' mode. How can I
change it back to 'normal' mode, as if they clicked cancel?

e.cancel = true doesnt seem to work.

Thanks.
Nov 19 '08 #2
I've tried that as well as other ways...

Protected Sub gvSubusers_RowU pdated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewUpdatedEven tArgs) Handles
gvSubusers.RowU pdated

e.KeepInEditMod e = False

gvSubusers.Edit Index = -1

End Sub

This gv is bound to an objectdatasourc e. But I don't think that should
matter. Also it's in an updatepanel.
Nov 19 '08 #3
Add the following to the last line of your event method:
gvSubusers.Data Bind();

This will cause the grid to refresh and it will see that it is not in edit
mode and the row will be back to normal mode.

"Bobby Edward" wrote:
I've tried that as well as other ways...

Protected Sub gvSubusers_RowU pdated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Grid ViewUpdatedEven tArgs) Handles
gvSubusers.RowU pdated

e.KeepInEditMod e = False

gvSubusers.Edit Index = -1

End Sub

This gv is bound to an objectdatasourc e. But I don't think that should
matter. Also it's in an updatepanel.
Nov 19 '08 #4
I tried that too but it didn't work. So I just the good ole'
response.redire ct back to the page. :(
Nov 19 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
19617
by: Yeah | last post by:
I have a multiple choice quiz where I would like to use CSS to change the color of the answers upon clicking them. I would like to present the right and wrong answers up front, rather than direct the user to a separate page with all correct answers. Do the answers have to be "links" for this to work? They have to be inactive links, because they don't actually go anywhere. They only serve the purpose of changing color whether they're...
0
1016
by: whatchu | last post by:
VS .NET 2003 Is it possible to get a form's FormWindowState.Normal coordinates that Windows has saved, WHILE the form is Maximized? i.e. click the restore box on a maximized form, and it goes back where it was. Can I get these coordinates? thanks!
1
3515
by: Prozon | last post by:
Hi! I have an asp.net page with a gridview. One "columnfield" in the grid contains boolean values. Is there a nice way to map this values to a string depending on the value. I.e I want to display the text "Yes" if true and "No" if false. Thanks / Steve
3
1601
by: John Daly | last post by:
I am using a Gridview to display a phone directory, with paging on. I have a link button that a user clicks to add a new record, which reloads the page, sets the visble property to false on the gridview and shows the form view in insert mode. Upon saving, the process is reversed. All is well and dandy, however I want to jump to the page that has the newly entered record, with the record highlighted. Does anyone know how to do this? I...
1
5630
by: mgonzales3 | last post by:
What is best method to create a nested gridview? Thanks
5
1989
by: Cindy Lee | last post by:
I want to have a button to view top 5 and toggle to view all on my gridview. Can this be done using paging? I don't want to show page 1, 2, 3. Just the top 5 or all. Or am I going to have to postback and change my query? If I do that I will also lose my current sorting. Any suggestions?
3
6804
by: rsdev | last post by:
Hi, I am creating a WYSIWIG CMS and when the user clicks on a linkbutton in an update panel, I would like to change the mode of the gridview to edit. I am confused about how to make a javascript event initialise an asp.net method? And also how to create a method that will change the rows in my gridview to editable when selected? Any help would be appreciated.
2
1985
by: inga2005 | last post by:
Hi! I have a very strange problem. I populate a gridview control with a list containing swedish cities and that looks fine. But once I click on one of the rows in the gridview to select that specific row the swedish characters å,ä,ö are translated into rubbish such as ## and other. Does anyone know why this is happning? Cheers /erik
2
8661
by: Ananthu | last post by:
Hi, I have a gridview with paging option. I want to maintain the state of the checkbox column in gridview for each page. I used vb.net coding. I used the following link for this purpose, http://aspalliance.com/774_Maintaining_State_of_CheckBoxes_While_Paging_in_a_GridView_Control
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10036
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.