Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Cannot add or edit rows

Reply
Thread Tools

Cannot add or edit rows

 
 
Scott Adams
Guest
Posts: n/a
 
      08-26-2003
I have a datagrid bound to a single table that I want users to be able to
add new rows and edit existing rows. My problem occurs when I apply custom
formatting to my columns. Consider the following code:

cn = New SqlConnection(SQL_CONNECTION_STRING)
da = New SqlDataAdapter("SELECT * FROM table_name", cn)
cb = New SqlCommandBuilder(da)
ds = New DataSet
da.Fill(ds, "table_name")
MyDataGrid.DataSource = ds.Tables("table_name")

The above block will allow the functionality I wish to create. If I apply
the next block of code (formatting one of the DataGridTextBoxColumns), I can
no longer add or edit rows.

Dim grdTableStyle1 As New DataGridTableStyle()
grdTableStyle1.MappingName = "table_name"
Dim grdColStyle1 As New DataGridTextBoxColumn()
grdColStyle1.HeaderText = "Header Text"
grdColStyle1.MappingName = "field_name"
grdTableStyle1.GridColumnStyles.AddRange (New DataGridColumnStyle()
{grdColStyle1})
Me.grdTransit.TableStyles.Add(grdTableStyle1)

Thanks in advance for the suggestions.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot add Rows java.lang.ArrayIndexOutOfBoundsException: 2 >= 2 hon123456 Java 3 05-14-2010 11:53 AM
dynamically add new rows and save data typed in these rows to a database Arjen Hoekstra ASP .Net 0 08-02-2005 12:15 PM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
script for moving rows up and down and traverse thru rows of HTML table Subba Rao via DotNetMonster.com ASP .Net 0 03-19-2005 06:46 AM



Advertisments