473,398 Members | 2,404 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,398 software developers and data experts.

Datagrid inserts blank space into textboxes?

Roy
Hey All,

Kind of a series of anomalies here with one root source, I believe. I
have an editable, paging datagrid.

1.When one clicks "edit" textboxes open up on row x, HOWEVER, if one
clicks "next page" the textboxes remain no matter which page you are
on. No error messages are shown.
2.After editing data, when one clicks "update" the page refreshes, but
*no* new data is actually loaded into the db. No error messages are
given.
3.If there exists data within an editable textbox and you click "edit,"
the fields on the same row have extra space (blank, empty space)
inserted into them which generates errors when I click "update" unless
I go through and delete the spaces.

Posted is my Update SUB below. Any suggestions are very much
appreciated.

*******************
Sub MyDataGrid_UpdateCommand(Sender As Object, E As
DataGridCommandEventArgs)

'Assign variables to columns
Dim voydoc As String = E.Item.Cells(2).Text
Dim poe As String = E.Item.Cells(3).Text
Dim poe_cnt As String = E.Item.Cells(4).Text
Dim ll_cnt As String = E.Item.Cells(5).Text
Dim assigned_to as String = CType(e.Item.Cells(6).Controls(0),
TextBox).Text
Dim assigned_dt as String = CType(e.Item.Cells(7).Controls(0),
TextBox).Text
Dim poe_recon_done as String = CType(e.Item.Cells(8).Controls(0),
TextBox).Text
Dim vdn_done as String = CType(e.Item.Cells(9).Controls(0),
TextBox).Text
Dim vdn_done_dt as String = CType(e.Item.Cells(10).Controls(0),
TextBox).Text
Dim final_appvl as String = CType(e.Item.Cells(11).Controls(0),
TextBox).Text
Dim final_appvl_dt as String = CType(e.Item.Cells(12).Controls(0),
TextBox).Text
Dim pod As String = E.Item.Cells(13).Text
Dim carrier_wv as String = CType(e.Item.Cells(14).Controls(0),
TextBox).Text
Dim notes as String = CType(e.Item.Cells(15).Controls(0), TextBox).Text

Dim objCommand As SqlCommand
Dim strSQLQuery As String

'Update command
strSQLQuery = "UPDATE [lla] " & _
"SET voydoc = N'" & voydoc.Trim & "', " & _

"poe = N'" & poe.Trim & "', " & _
"poe_cnt = '" & poe_cnt.Trim & "', " & _
"ll_cnt = '" & ll_cnt.Trim & "', " & _
"assigned_to = N'" & Replace(assigned_to.Trim, "'", "''") & "', " & _
"assigned_dt = '" & Replace(assigned_dt.Trim, "'", "''") & "', " & _
"poe_recon_done = '" & Replace(poe_recon_done.Trim, "'", "''") & "', "
& _
"vdn_done = '" & Replace(vdn_done.Trim, "'", "''") & "', " & _
"vdn_done_dt = '" & Replace(vdn_done_dt.Trim, "'", "''") & "', " & _
"final_appvl = '" & Replace(final_appvl.Trim, "'", "''") & "', " & _
"final_appvl_dt = '" & Replace(final_appvl_dt.Trim, "'", "''") & "', "
& _
"pod = '" & pod.Trim & "', " & _
"carrier_web_validation = '" & Replace(carrier_wv.Trim, "'", "''") &
"', " & _
"notes = N'" & Replace(notes.Trim, "'", "''") & "' " & _
"WHERE ISNULL(voydoc,'') = '" & voydoc.Trim & "' AND ISNULL(poe,'') =
'" & poe.Trim & "'"
MyConnection.Open()
objCommand = New SqlCommand(strSQLQuery, MyConnection)
objCommand.ExecuteNonQuery()
MyConnection.Close()

MyDataGrid.EditItemIndex = -1
MyDataGrid.DataBind()

BindData()

End Sub

Nov 21 '05 #1
1 1829
Roy
Anyone have any tips? At all?

:)

Nov 21 '05 #2

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

Similar topics

0
by: Jan Keller | last post by:
Hello all, I am using an XmlTextReader and a DataSet to populate a DataGrid: ds = New DataSet xr = New XmlTextReader(path) ds.ReadXml(xr) xr.Close() dv = New DataView(ds.Tables.Item(0))
1
by: Stephen | last post by:
I have the following for a datagrid that inserts a row into an xml file. It works great, but inserts the data to a new top-level node. I don't know how to specifiy an existing node for the...
1
by: GregM | last post by:
I have a read only datagrid that is designed to coordinate itself with textboxes. When the user clicks on a row in the datagrid, detailed data for that row is displayed for editing in the...
1
by: Jason | last post by:
I have created a datagrid with several template columns and included validation controls in the template columns. I also have a button column with edit-update-cancel. When the datagrid item is...
4
by: MrMike | last post by:
Is it possible to specify (or somehow set) the amount of space between each datagrid row without changing the amount of space between datagrid columns? I have a datagrid displaying data which...
1
by: Dan11 | last post by:
here's C sharp code: Start code... private void searchBtn_Click(object sender, System.EventArgs e) { //For sqlCommand1 is a search by Wkst ID (employeeID on pubs) params if...
10
by: Aaron Smith | last post by:
If I have a datagrid and the bound data file only have 4 rows in it, the grid will show the 4 rows. However, there is blank space below that until it reaches the bottom of the grid. Is there a way...
9
by: mfahnestock | last post by:
Hi all! Aspiring VB programmer losing hair <And Sleep> over this problem. I have spent several days researching through the various usenets and resources to no avail, and so now I am taking the...
2
by: Iain | last post by:
Hi All Using Delphi 2006 developer - C# Project I have the following 2 event handlers for the datagrid - see botton of page Both events will fire off correctly but i have a problem collecting...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
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...

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.