IButtonControl.Click

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default IButtonControl.Click

    hello everyone,

    i am trying to set the defaultbutton property and i get the following error:

    The DefaultButton of '' must be the ID of a control of type IButtonControl.


    so i guess instead of this class declaration:

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace IS.WebControls
    {
    public class ISBaseButton : Button
    {
    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    this.CssClass = "frmbtn";
    }
    }
    }


    i need this one:

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace IS.WebControls
    {
    public class ISBaseButton : WebControl, IButtonControl,
    IPostBackEventHandler
    {
    private bool blCausesValidation = false;
    private string strCommandArgument = "";
    private string strCommandName = "";
    private string strPostBackUrl = "";
    private string strText = "";
    private string strValidationGroup = "";

    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    this.CssClass = "frmbtn";
    }

    bool IButtonControl.CausesValidation
    {
    get
    {
    return blCausesValidation;
    }
    set
    {
    blCausesValidation = value;
    }
    }

    string IButtonControl.CommandArgument
    {
    get
    {
    return strCommandArgument;
    }
    set
    {
    strCommandArgument = value;
    }
    }

    string IButtonControl.CommandName
    {
    get
    {
    return strCommandName;
    }
    set
    {
    strCommandName = value;
    }
    }

    string IButtonControl.PostBackUrl
    {
    get
    {
    return strPostBackUrl;
    }
    set
    {
    strPostBackUrl = value;
    }
    }

    string IButtonControl.Text
    {
    get
    {
    return strText;
    }
    set
    {
    strText = value;
    }
    }

    string IButtonControl.ValidationGroup
    {
    get
    {
    return strValidationGroup;
    }
    set
    {
    strValidationGroup = value;
    }
    }

    public void IButtonControl.Click(Object Sender, EventHandler E)
    {
    //
    }
    }
    }


    so that the defaultbutton property can work. i need help in declaring the
    IButtonControl.Click and the IButtonControl.Command event. everything i have
    tried fails, and i've searched the internet for examples and have found
    nothing that works.

    so far i've tried:

    EventHandler IButtonControl.Click(Object Sender, EventArgs E)
    {
    //
    }


    and many others.


    thanks for your help.


    Abraham Andres Luna Guest

  2. Similar Questions and Discussions

    1. double click causes click-event anddoubleClick-event
      I too am interested in a response to this. I see all kinds of information on how to enable the double-click event, but not how to distinguish...
    2. Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl.
      Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2....
    3. Click / Double Click
      Am I doing something wrong? Wrong coding? Wrong handler? I am rying to get the button to fire on clicking..... it WILL work on "double click"... any...
    4. Single click vs double click in mouseDown and mouseUp
      For a double click mouseDown and mouseUp catch 2 event: the first report clickCount value 1 and the second report value 2. How to respond to a...
    5. Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only
      Background: On my webform a simple datalist shows one column. The databind is done in the page_load event. In the ItemTemplate a linkbutton serves...
  3. #2

    Default Re: IButtonControl.Click

    Hi,

    Button base class already implements IButtonControl, so you shouldn't need
    to reimplement the interface. Wth your ISBaseButton you could use:

    <form id="form1" runat="server" defaultbutton="Button1" >
    ....
    <cc:ISBaseButton ID="Button1" runat="server" />

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]

    "Abraham Andres Luna" <brag1518@hotmail.com> wrote in message
    news:eg7LO$$BHHA.996@TK2MSFTNGP02.phx.gbl...
    > hello everyone,
    >
    > i am trying to set the defaultbutton property and i get the following
    > error:
    >
    > The DefaultButton of '' must be the ID of a control of type
    > IButtonControl.
    >
    >
    > so i guess instead of this class declaration:
    >
    > using System;
    > using System.Web.UI;
    > using System.Web.UI.WebControls;
    >
    > namespace IS.WebControls
    > {
    > public class ISBaseButton : Button
    > {
    > protected override void OnInit(EventArgs e)
    > {
    > base.OnInit(e);
    > this.CssClass = "frmbtn";
    > }
    > }
    > }
    >
    >
    > i need this one:
    >
    > using System;
    > using System.Web.UI;
    > using System.Web.UI.WebControls;
    >
    > namespace IS.WebControls
    > {
    > public class ISBaseButton : WebControl, IButtonControl,
    > IPostBackEventHandler
    > {
    > private bool blCausesValidation = false;
    > private string strCommandArgument = "";
    > private string strCommandName = "";
    > private string strPostBackUrl = "";
    > private string strText = "";
    > private string strValidationGroup = "";
    >
    > protected override void OnInit(EventArgs e)
    > {
    > base.OnInit(e);
    > this.CssClass = "frmbtn";
    > }
    >
    > bool IButtonControl.CausesValidation
    > {
    > get
    > {
    > return blCausesValidation;
    > }
    > set
    > {
    > blCausesValidation = value;
    > }
    > }
    >
    > string IButtonControl.CommandArgument
    > {
    > get
    > {
    > return strCommandArgument;
    > }
    > set
    > {
    > strCommandArgument = value;
    > }
    > }
    >
    > string IButtonControl.CommandName
    > {
    > get
    > {
    > return strCommandName;
    > }
    > set
    > {
    > strCommandName = value;
    > }
    > }
    >
    > string IButtonControl.PostBackUrl
    > {
    > get
    > {
    > return strPostBackUrl;
    > }
    > set
    > {
    > strPostBackUrl = value;
    > }
    > }
    >
    > string IButtonControl.Text
    > {
    > get
    > {
    > return strText;
    > }
    > set
    > {
    > strText = value;
    > }
    > }
    >
    > string IButtonControl.ValidationGroup
    > {
    > get
    > {
    > return strValidationGroup;
    > }
    > set
    > {
    > strValidationGroup = value;
    > }
    > }
    >
    > public void IButtonControl.Click(Object Sender, EventHandler E)
    > {
    > //
    > }
    > }
    > }
    >
    >
    > so that the defaultbutton property can work. i need help in declaring the
    > IButtonControl.Click and the IButtonControl.Command event. everything i
    > have
    > tried fails, and i've searched the internet for examples and have found
    > nothing that works.
    >
    > so far i've tried:
    >
    > EventHandler IButtonControl.Click(Object Sender, EventArgs E)
    > {
    > //
    > }
    >
    >
    > and many others.
    >
    >
    > thanks for your help.
    >
    >

    Teemu Keiski Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139