Cannot add or edit rows

Discussion in 'ASP .Net Datagrid Control' started by Scott Adams, Aug 26, 2003.

  1. Scott Adams

    Scott Adams Guest

    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.
    Scott Adams, Aug 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,201
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  2. helpful sql
    Replies:
    0
    Views:
    798
    helpful sql
    May 19, 2005
  3. Arjen Hoekstra
    Replies:
    0
    Views:
    542
    Arjen Hoekstra
    Aug 2, 2005
  4. Jason James

    Rows the rows of a grid view?

    Jason James, Aug 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    385
    Jason James
    Aug 10, 2006
  5. hon123456
    Replies:
    3
    Views:
    2,346
    John B. Matthews
    May 14, 2010
Loading...

Share This Page