473,385 Members | 1,813 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.

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_EditCommand

Code is:

DataGrid1.edititemindex=e.item.itemindex

DataGrid1.DataBind()

Event is :

DataGrid1_UpdateCommand

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 SqlCommandBuilder(SqlDataAdapter1)

SqlDataAdapter1.update(DataSet1.Tables(0))

DataGrid1.EditItemIndex=-1

DataGrid1.DataBind()

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 1173
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_EditComman

Code is

DataGrid1.edititemindex=e.item.iteminde

DataGrid1.DataBind(

Event is

DataGrid1_UpdateComman

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 SqlCommandBuilder(SqlDataAdapter1

SqlDataAdapter1.update(DataSet1.Tables(0)

DataGrid1.EditItemIndex=-

DataGrid1.DataBind(

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
by: vijaya | last post by:
How can I update multiple columns of my datagrid at a time in my application?
1
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
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...
1
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...
1
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...
0
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...
0
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...
0
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...
0
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
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...
0
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,...

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.