473,799 Members | 2,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Upda teCommand(Sende r As Object, E As
DataGridCommand EventArgs)

'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.Ce lls(6).Controls (0),
TextBox).Text
Dim assigned_dt as String = CType(e.Item.Ce lls(7).Controls (0),
TextBox).Text
Dim poe_recon_done as String = CType(e.Item.Ce lls(8).Controls (0),
TextBox).Text
Dim vdn_done as String = CType(e.Item.Ce lls(9).Controls (0),
TextBox).Text
Dim vdn_done_dt as String = CType(e.Item.Ce lls(10).Control s(0),
TextBox).Text
Dim final_appvl as String = CType(e.Item.Ce lls(11).Control s(0),
TextBox).Text
Dim final_appvl_dt as String = CType(e.Item.Ce lls(12).Control s(0),
TextBox).Text
Dim pod As String = E.Item.Cells(13 ).Text
Dim carrier_wv as String = CType(e.Item.Ce lls(14).Control s(0),
TextBox).Text
Dim notes as String = CType(e.Item.Ce lls(15).Control s(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_t o = N'" & Replace(assigne d_to.Trim, "'", "''") & "', " & _
"assigned_d t = '" & Replace(assigne d_dt.Trim, "'", "''") & "', " & _
"poe_recon_ done = '" & Replace(poe_rec on_done.Trim, "'", "''") & "', "
& _
"vdn_done = '" & Replace(vdn_don e.Trim, "'", "''") & "', " & _
"vdn_done_d t = '" & Replace(vdn_don e_dt.Trim, "'", "''") & "', " & _
"final_appv l = '" & Replace(final_a ppvl.Trim, "'", "''") & "', " & _
"final_appv l_dt = '" & Replace(final_a ppvl_dt.Trim, "'", "''") & "', "
& _
"pod = '" & pod.Trim & "', " & _
"carrier_web_va lidation = '" & Replace(carrier _wv.Trim, "'", "''") &
"', " & _
"notes = N'" & Replace(notes.T rim, "'", "''") & "' " & _
"WHERE ISNULL(voydoc,' ') = '" & voydoc.Trim & "' AND ISNULL(poe,'') =
'" & poe.Trim & "'"
MyConnection.Op en()
objCommand = New SqlCommand(strS QLQuery, MyConnection)
objCommand.Exec uteNonQuery()
MyConnection.Cl ose()

MyDataGrid.Edit ItemIndex = -1
MyDataGrid.Data Bind()

BindData()

End Sub

Nov 21 '05 #1
1 1853
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
1345
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
1349
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 inserted item: void DataGrid1_Update(Object Sender, DataGridCommandEventArgs e) { try { string stitle = (e.Item.Cells.FindControl("txttitle") as TextBox).Text; DataSet ds = new DataSet();
1
2916
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 textboxes. The datagrid and textboxes are populated from the same underlying SQL Server table but using different strongly typed data adapters and datasets for display and editing. So I coordinate syncronization of the two sets of data using code. I use...
1
1284
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 in editmode I can change the values of the data with textboxes. If I actually enter data in the textboxes that are being validated by the validation controls it validates the control and shows the error summary. However if I never go to the...
4
1376
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 needs to print on specially-sized labels. In order to accurately print one-datagrid row-per-label, I need to somehow set 2-inches of blank space between each row. CellPadding and CellSpacing settings affect the amount of space between columns, as...
1
1228
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 (txtEmployeeID.Text.Length > 0) {
10
8134
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 to have a fixed number of rows regardless of what data is in the bound table? Thanks, Aaron -- --- Aaron Smith
9
9771
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 next step. Situation: I have a form (Form 1) with a datagrid that has a context menu for adding updated records. When selecting the "Add Option" a second form (Form 2) is displayed for data population. The user saves the
2
1989
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 the correct data in teh Update event - I have noted the problem in the event handler
0
9689
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
10269
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
10032
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
7573
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
6811
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
5469
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
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.