473,804 Members | 3,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid updation

AA
We want to edit, update data of DataGrid in Asp.Net with VB.Net.and are

writing the following code for EditCommand and UpdateCommand

Event is :

DataGrid1_EditC ommand

Code is:

DataGrid1.editi temindex=e.item .itemindex

DataGrid1.DataB ind()

Event is :

DataGrid1_Updat eCommand

Code is:

Dim s as string

s=ctype(e.item. cells[2].Controls[0],textbox).text

Response.Write( s)

DataSet1.Tables (0).Rows(e.item .itemindex)(1)= s

Dim cmp as new SqlCommandBuild er(SqlDataAdapt er1)

SqlDataAdapter1 .update(DataSet 1.Tables(0))

DataGrid1.EditI temIndex=-1

DataGrid1.DataB ind()

This code does not show any error.

But there is problem,

when we modify any value of a record then

command [ s=ctype(e.item. cells[2].Controls[0],textbox).text ]

returns previous value.

If we write a fixed value in code to change it in datagrid then it updates

DataSet1.Tables (0).Rows(e.item .itemindex)(1)= HdDH This command updates

data in database

Therefore, problem is in retrieving current value from datagrid not in

updation command. How to access modified value of DataGrid
Nov 18 '05 #1
1 1190
Hi

It looks like that you bind the grid before updating
Do you do a databind in page_load event

Bin Song, MC

----- AA wrote: ----

We want to edit, update data of DataGrid in Asp.Net with VB.Net.and ar

writing the following code for EditCommand and UpdateComman

Event is

DataGrid1_EditC omman

Code is

DataGrid1.editi temindex=e.item .iteminde

DataGrid1.DataB ind(

Event is

DataGrid1_Updat eComman

Code is

Dim s as strin

s=ctype(e.item. cells[2].Controls[0],textbox).tex

Response.Write( s

DataSet1.Tables (0).Rows(e.item .itemindex)(1)=

Dim cmp as new SqlCommandBuild er(SqlDataAdapt er1

SqlDataAdapter1 .update(DataSet 1.Tables(0)

DataGrid1.EditI temIndex=-

DataGrid1.DataB ind(

This code does not show any error

But there is problem

when we modify any value of a record the

command [ s=ctype(e.item. cells[2].Controls[0],textbox).text

returns previous value

If we write a fixed value in code to change it in datagrid then it update

DataSet1.Tables (0).Rows(e.item .itemindex)(1)= HdDH This command update

data in databas

Therefore, problem is in retrieving current value from datagrid not i

updation command. How to access modified value of DataGri

Nov 18 '05 #2

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

Similar topics

0
1108
by: vijaya | last post by:
How can I update multiple columns of my datagrid at a time in my application?
1
1413
by: AA | last post by:
We want to edit, update data of DataGrid in Asp.Net with VB.Net.and are writing the following code for EditCommand and UpdateCommand Event is : DataGrid1_EditCommand
0
1078
by: Lakshmi Narayanan.R | last post by:
Hi Experts I am new to .NET. I need great explanation for "the updation in the disconnected data". How it is handled. That is, if mutiple user is interacting with the data, one will delete another will insert or update. So after the modifications how the correct updation is made in the database table. What the hidden mechanism is there. The updation logic is confusing Pls help me, if any articles available let me know them Thanks in...
1
2029
by: ashfaq Gul via DotNetMonster.com | last post by:
Please help me.... i want to update record in datagrid without postback ....and the main thing that the confirmation of record updation should be from server not client ...because overwritting problem may occur if more than one user are updating the same record.... Please help.. -- Message posted via http://www.dotnetmonster.com
1
1218
by: Babz | last post by:
Hi, How I can prevent concurrent updation of a records in .net. I am using Dataset which is disconnected from the data source. In this situation if two users opens the same record, modifies the data and updates one after another, my data won't be in the correct state. How I can prevent this. Is there any locking technics.
0
935
by: Hardik Shah | last post by:
Hi, I have a datagrid with few fields, some of them are to be updated automatically, i.e. Sould be replaced time of the entry in entry_time field and Name of the user in usr_name field. When my user enter data for perticular row, these fields also automatically updated each time. What should I do for it .. Any hints please.
0
1299
by: prashant | last post by:
Hi, I am trying to set up Transactional replication with immediate updation. The configuration is as follows: 1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the same server. 2. Publisher SQL server is installed on Windows 2003.
0
810
by: dwadish | last post by:
guys i am new to asp.net 2003 with vb. so i have a problem with updation and deletion of records from datagrid. but i can do the edit function from here. i well tried for getting it. provide a code or a solution 4 it. how i can do the delete and update. Thanx in Advance
0
790
by: prathimaCHOWDARY | last post by:
can any one tell me to write the script for updation in datagrid ie iwant instant updation i.e at runtime
1
1686
by: siri11 | last post by:
Hi everyone!!!!!!!!! If i update a record in a table in sqlserver from front end (c#.net),using a stored procedure for updating then after updation if i open the table then it is showing the same record 2 times i.e before updation record and after updation record..Plzzzzzzzz help me how to solve this problem....its very urgent...Plzzzzzzzzzz Thanks in advance siri
0
9705
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
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
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...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
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
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
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.