[CLOSED] code behind for top bar

  1. #1

    [CLOSED] code behind for top bar

    Hi, i have TopBar for grid panel.

    <TopBar>
        <ext:Toolbar ID="Toolbar4" runat="server">
            <Items>
                <ext:ToolbarFill ID="ToolbarFill4" runat="server" />
                            
                <ext:Button ID="Button1" Text="Chart" Icon="PageCode" runat="server">
                    <Listeners>
                        <Click Handler="openABC('abc', 'def')"></Click>
                    </Listeners>                      
                </ext:Button>
    
                <ext:Button ID="Button2" runat="server" OnClick="button_click_def" AutoPostBack="true" Text="Excel" Icon="PageExcel">
                    <Listeners>
                        <Click Handler="SetVal(#{Hidden1}, 'abc', #{Hidden2}, 'def)"></Click>
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Toolbar>
    </TopBar>
    i write the code in code behind for this button control.
    Button br = new Button();
                br.ID = GridPanel_ID.ID + "Button1";
                br.Text = "ABC";
                br.Icon = Icon.PageCode;
                br.Listeners.Click.Handler = "openABC('abc', 'def')";
    for the second button how can i define the OnClick handler or button controll??
    Last edited by Daniil; Apr 05, 2013 at 4:41 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi @extnetuser,

    Welcome to the Ext.NET forums!

    Quote Originally Posted by extnetuser View Post
    for the second button
    What is the second button? Is it the button with "Button2" ID?

    Quote Originally Posted by extnetuser View Post
    how can i define the OnClick handler or button controll??
    Define button control? Sorry, I don't understand. Please clarify what you mean.

    I see you defined OnClick and Click Listener at the same time for the Button2. I would leave Click Listener or OnClick only.

    Here is the blog post regarding Ext.NET Event Driven Model.
    http://www.ext.net/2012/12/19/introd...xt-net-events/
  3. #3

    Re: code behind for top bar

    Quote Originally Posted by Daniil View Post

    What is the second button? Is it the button with "Button2" ID?
    Yes, i am talking about Button2.

    Quote Originally Posted by Daniil View Post
    Define button control? Sorry, I don't understand. Please clarify what you mean.
    How can i write code in the cs(code behind, like in the first button how i defined) file

    Quote Originally Posted by Daniil View Post
    I see you defined OnClick and Click Listener at the same time for the Button2. I would leave Click Listener or OnClick only.
    you can leave Listener. but, i am interested to use both :)
    Last edited by Daniil; Apr 05, 2013 at 3:55 PM. Reason: Please use [QUOTE] tags
  4. #4
    Sorry, I mixed OnClick and OnClientClick.

    This way.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.Button btn = new Ext.Net.Button();
            btn.Text = "Button";
            btn.Listeners.Click.Handler = "alert('client handler');";
            btn.Click += btn_Click;
            btn.AutoPostBack = true;
    
            this.Form.Controls.Add(btn);
        }
    
        protected void btn_Click(object sender, EventArgs e)
        {
            
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
        </form>
    </body>
    </html>
    Do you really need a hard PostBack? You could use a Button's Click DirectEvent. It makes an AJAX request.
  5. #5
    Thank you very much, the problem is solved.
    btn.Click += btn_Click;
    did do the trick. Thread can be closed.

Similar Threads

  1. Replies: 1
    Last Post: Nov 13, 2012, 1:36 PM
  2. Grid + MVC 3 + EF Code First + CRUD - Error code 200
    By millenovanta in forum 2.x Help
    Replies: 5
    Last Post: Sep 08, 2012, 4:31 PM
  3. Replies: 2
    Last Post: Feb 01, 2012, 6:56 AM
  4. Replies: 1
    Last Post: Jul 07, 2011, 8:34 PM
  5. Convert FormPanel from Html-Code to VB.Net Code
    By stephan1985 in forum 1.x Help
    Replies: 1
    Last Post: Jan 27, 2010, 3:47 PM

Tags for this Thread

Posting Permissions