can find ImageButton but can't find button

Discussion in 'ASP .Net' started by ad, Nov 20, 2005.

  1. ad

    ad Guest

    I have a Button (named btnOK) and a ImageButton (named ImageButton1) in a
    Template field of a GridView;
    I use the codes below to find the Button and ImageButton, the ImageButton
    can be found, but Button can't find.
    Why?



    protected void gvCheckSem_RowEditing(object sender, GridViewEditEventArgs
    e)
    {
    Button btnOk = (Button)gvCheckSem.Rows[e.NewEditIndex].FindControl("btnOK");
    ImageButton btn1 =
    (ImageButton)gvCheckSem.Rows[e.NewEditIndex].FindControl("ImageButton1");

    ....
    }
    ad, Nov 20, 2005
    #1
    1. Advertising

  2. Make sure you have runat=server set by btnOK.

    Eliyahu

    "ad" <> wrote in message
    news:...
    >I have a Button (named btnOK) and a ImageButton (named ImageButton1) in a
    >Template field of a GridView;
    > I use the codes below to find the Button and ImageButton, the ImageButton
    > can be found, but Button can't find.
    > Why?
    >
    >
    >
    > protected void gvCheckSem_RowEditing(object sender, GridViewEditEventArgs
    > e)
    > {
    > Button btnOk =
    > (Button)gvCheckSem.Rows[e.NewEditIndex].FindControl("btnOK");
    > ImageButton btn1 =
    > (ImageButton)gvCheckSem.Rows[e.NewEditIndex].FindControl("ImageButton1");
    >
    > ...
    > }
    >
    Eliyahu Goldin, Nov 20, 2005
    #2
    1. Advertising

  3. ad

    ad Guest

    I have verified again, I have set runat=serrver on btnOK.


    "Eliyahu Goldin" <> ¼¶¼g©ó¶l¥ó·s»D:...
    > Make sure you have runat=server set by btnOK.
    >
    > Eliyahu
    >
    > "ad" <> wrote in message
    > news:...
    >>I have a Button (named btnOK) and a ImageButton (named ImageButton1) in
    >>a Template field of a GridView;
    >> I use the codes below to find the Button and ImageButton, the ImageButton
    >> can be found, but Button can't find.
    >> Why?
    >>
    >>
    >>
    >> protected void gvCheckSem_RowEditing(object sender, GridViewEditEventArgs
    >> e)
    >> {
    >> Button btnOk =
    >> (Button)gvCheckSem.Rows[e.NewEditIndex].FindControl("btnOK");
    >> ImageButton btn1 =
    >> (ImageButton)gvCheckSem.Rows[e.NewEditIndex].FindControl("ImageButton1");
    >>
    >> ...
    >> }
    >>

    >
    >
    ad, Nov 20, 2005
    #3
    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. Replies:
    2
    Views:
    470
  2. =?Utf-8?B?QmlsbCBCb3Jn?=

    Can't set imagebutton to default button

    =?Utf-8?B?QmlsbCBCb3Jn?=, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,191
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Apr 28, 2005
  3. Replies:
    4
    Views:
    532
  4. mhylden

    how to make imagebutton respond to click but not return key

    mhylden, Sep 28, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    157
    mhylden
    Sep 28, 2005
  5. mhylden
    Replies:
    1
    Views:
    136
    mhylden
    Sep 28, 2005
Loading...

Share This Page