GridView / ButtonType - Strange behaviour.

Discussion in 'ASP .Net' started by maryjones11289@hotmail.com, Oct 18, 2006.

  1. Guest

    Hi,

    I have a strange problem that hopefully someone can advise me on...

    I have a Gridview which is not bound to a dataset etc. I populate the
    gridview manually by constructing my own table, defining grid columns
    then binding it to my table etc. Several of the columns in the gridview
    are of type ButtonField with ButtonType set to "Button"

    Now, all of this is working fine...no problems whatsoever.

    I decided later that rather than a button I wanted a link instead, so I
    simply changed "MyCol.ButtonType = ButtonType.Button" to
    "MyCol.ButtonType = ButtonType.Link"

    My problem is that by making this simple change, the page does not
    work. The page still renders exactly as expected, but when I click on
    one of the link buttons, none of the events are fired...instead, I get
    the icon at the bottom left of explorer indicating an error on the
    page. When I look at the error all I get is:

    Line: 1
    Char: 1
    Error: Object expected
    Code: 0
    URL: xxxxxxxxxx



    Remember, the only change I made was to change the ButtonType, nothing
    else.

    Can anyone advise as to what could be the problem please. I've looked
    at the properties of the ButtonField column to see if there are
    properties specific to a link type button that I should be setting, but
    there doesn't appear to be any.

    Please note that I do not want a HyperLinkField, which would require me
    to set a NavigateURL...I want to be able to catch the OnClick event of
    the Button (which looks like a link)

    Thanks in advance,

    MJ
    , Oct 18, 2006
    #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. Nick Gilbert
    Replies:
    2
    Views:
    873
    Jeffrey Tan[MSFT]
    Dec 15, 2003
  2. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    How to change color,width,style of Edit,Dlete,add of buttontype

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    934
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Oct 5, 2004
  3. Arpan

    DataGrid ButtonColumn ButtonType?

    Arpan, Aug 17, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    552
    Arpan
    Aug 17, 2006
  4. ton
    Replies:
    1
    Views:
    751
    Peter Bucher [MVP]
    Mar 11, 2008
  5. Nick Gilbert
    Replies:
    4
    Views:
    233
    Jeffrey Tan[MSFT]
    Dec 16, 2003
Loading...

Share This Page