How to work with Direct Events for button click in ext.net Controls using Asp.net ?


In my Previous article(Working with ext.net Controls) i had introduced how to work with ext.net Controls.In this Article i want to demonstrate how to write the Direct events of a button click for ext.net Controls using asp.net.

In my Previous article(Working with ext.net Controls) i had introduced the ext.net Controls.In this Article i want to demonstrate how to write the Direct events using asp.net with ext.net Controls ?

In Asp.net controls writing a button click event is easy by setting an attribute onclick event. But here in ext.net controls writing a button click event is not as that easy even though it is having an attribute/property same as asp.net Controls. Ext.net has many ways to handle the button onclick event one way of doing it is by Direct Event. So in this article i want to demonstrate how to use of Direct click event in ext.net Controls. Let us see the below code snippet




less than symbol ext:Button runat="server" Text="Run" Width="75" greater than symbol
less than symbol DirectEvents greater than symbol
less than symbol Click OnEvent="DoSomething" greater than symbol
lessthansymbol /Click greaterthan symbol
lessthansymbol / DirectEvents greaterthan symbol
lessthan/ ext:Button greaterthan symbol



Note : replace lessthansymbol(<) and greaterthansymbol(>) when you try this code in your application

on the above ext.net code you see the attribute of runat, text and width they are same as asp.net controls but you see the below tag DirectEvents is what the discrepancy with asp.net Controls actually this is the attribute i want to set my function for Click Event i.e.Click OnEvent ="DoSomething". DoSomething is the method that i will write the code in the Server side.

Now in the Server Side you see the below code



[DirectMethod]
public void DoSomething()
{
X.Msg.Notify("My Name is: ", Bhushan).Show();
}



Especially you are handling a direct event on the server side you need to specify on top of the Method that it is a Direct Method. ext.net Controls than only recognizes the event is a Direct Otherwise your event will not be fired on this Method. In that direct event i had called an message notify event which is 'MY NAME IS BHUSHAN' it will popup below of your form /screen


Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 73 articles authored by srirama

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: