Datagrid bound columns

Discussion in 'ASP .Net' started by Julie Barnet, Dec 2, 2003.

  1. Julie Barnet

    Julie Barnet Guest

    I would like to be able to either autogenerate my bound columns or
    create them at runtime based on parameters passed into the page.

    When doing either method, I cannot access any of the fields.

    For example:
    I have created a delete link button and used the edit/update template
    for an additional link button on each row (at design time). Inside
    the itemcommand event if I do a mydatagrid.columns.count ->I only get
    a value of 2. I should be getting 3.

    Also if I try to print:
    Response.Write(MyDataGrid.Columns.Item(0).HeaderText) ->Delete
    Response.Write(MyDataGrid.Columns.Item(1).HeaderText) ->Edit
    Response.Write(MyDataGrid.Columns.Item(2).HeaderText) ->Out of index
    error

    One last test (itemcommand event):
    response.write(e.Item.Cells(2).text) ->Out of index error

    This happens when autogenerating columns or if I create the last
    column at runtime (I created a databind function, and I create the
    column from there each time I want to databind my grid.)

    Thanks in advance
    Julie Barnet
     
    Julie Barnet, Dec 2, 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. Dan
    Replies:
    2
    Views:
    3,497
  2. =?Utf-8?B?RGF2aWQ=?=

    Help a newbie... (DataGrid bound & template columns)

    =?Utf-8?B?RGF2aWQ=?=, Feb 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    438
    Vadivel Kumar
    Feb 10, 2005
  3. =?Utf-8?B?Sm9u?=

    Datagrid, adding bound columns.

    =?Utf-8?B?Sm9u?=, Feb 15, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    433
    =?Utf-8?B?Sm9u?=
    Feb 15, 2006
  4. Replies:
    1
    Views:
    496
    =?Utf-8?B?U2VyZ2V5IFp1eWV2?=
    Sep 21, 2006
  5. Vinki

    template columns and bound columns in gridview

    Vinki, Apr 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    926
    Vinki
    Apr 25, 2007
Loading...

Share This Page