locked
Extending Button Control RRS feed

  • Question

  • User1992878454 posted

    Hi All, I am trying to extend the button web control to take more information for the purposes of a small app I am writing.  I am currently overriding the  RenderControl method.  If I keep in the base.RenderControl(output) call, I get an empty button, as well as the output I'd like; I presume I'm calling the wrong Render method, however I'm a bit confused as to the difference between them, and which one will give me the output desired.

     

    Any help would be appreciated

     

    Owen

    Sunday, July 20, 2008 6:45 AM

Answers

All replies

  • User481221548 posted

    Hi Owen

    Override the Render (or RenderBegin- EndTag, etc....) Methods.
    You can also composite a Control by adding SubControls to the Control-Collection.

    Sunday, July 20, 2008 2:02 PM
  • User1992878454 posted

     Hi,

    Apologies, I'm not sure I explained myself very well.

     

    Currently I am overridding the Render method with the output I'd like, however if I remove the call to base.Render I lose the Click functionality that I am trying to keep.  

    If I add the code to RenderBeginTag, and remove calls to base.RenderBeginTag and base.RenderEndTag, I also lose the click functionality...

     

    I haven't done anything in ASP.NET before, so there's a good chance I'm just being stupid, but any help would be great!

     

    Owen

    Monday, July 21, 2008 9:58 AM
  • User481221548 posted

    Hi Owen

    You aren`t stupid :)

    You writing from "Extending the Button Functionality".
    Extending means _to extend_, not _to modify base functionality_ primarily.

    So - of course - you can modify the base Functionality, but you have also to ensure that the Base is working proper after your "Modify".
    I would say: What exactly you want to do?

    Depending on what you want, i can help you better.

    Monday, July 21, 2008 1:18 PM
  • User1992878454 posted

     I'm not sure if I'm going about this the right way,but what I am trying to do is effectively create a label with click functionality. 

    In windows forms you'd just override the Paint method to draw what you'd like, but I'm guessing there are some added caveats in ASP that I'm not aware of.

     

    I am trying to dispay two lines of text, with different formatting on each line, so all I am doing is creating a table with 2 rows as the output.

     If it would be easier to create a click event for a label, or a custom control, could you point me in the direction of a tutorial/guide that could help?
    Thanks in advance,

     

    Owen

    Monday, July 21, 2008 3:36 PM
  • User481221548 posted

    Hi Owen

    There is alot more to know if you wanna do such an implementation.
    You have "only" GET or POST to submit something to the server back from the userinterface.

    So, with a <label>....-tag you don`t have the possibility to send form-data.
    Of course you can work with javascript to initiate a form-submit and pass some parameters in.

    Beside that facts (theres alot more of it), you have to understand the eventmechanism or at least how to implement.
    I`ve written an article on it in German. Read the Translation and use the original url to read the code properly. (There`s also a example within the article)

    HTH

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 21, 2008 4:51 PM