The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

Add parametrs to directEvents

  1. #1

    Add parametrs to directEvents

    I need pass parametr "id" in Action.

           .Width(70)
                        .Commands(
                                 Html.X().GridCommand()
                                    .CommandName("Edit")
                                    .Icon(Icon.NoteEdit)
                                        .ToolTip(t =>
                                        {
                                            t.Text = "Modifica della ripartizione ferie per giorno";
                                        })
                                    )
                                    .ID("ID")
                                .DirectEvents(
                                        directEvents =>
                                        {
                                                 directEvents.Command.Action = "Details";                            
                                        })
                        )
    Action controller:

       // GET: Bob/Details/5
                public ActionResult Details(int id)
                {
                    if (id == null)
                    {
                        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    }
                    BobRepository bobRepository = new BobRepository();
                    Bob bob = bobRepository.GetBob(id);
                    return View(bob);
                }
    How i can pass .ID("ID") in Action?
  2. #2
    I dont really use razor but this is is the old way of doing it. Note the ExtraParams on the click event. i am sure you easily translate to Razor like DirectEvent.Click.ExtraParams or something like that.
    Note the Mode variable. it is Raw or Value.
    Raw means it will execute the JS and find a value (very helpful)
    Value means just passes it as is
    Good Luck!
    /Z

                                            <DirectEvents>
                                                <Click 
                                                    Url="/Controller/Method" 
                                                    Timeout="60000"
                                                    CleanRequest="true" 
                                                    Method="POST"
                                                    Success="alert('success');"
                                                    Failure="Ext.Msg.show({
                                                        title:   'Error',
                                                        msg:     result.message || result.errorMessage,
                                                        buttons: Ext.Msg.OK,
                                                        icon:    Ext.MessageBox.ERROR
                                                    });">
                                                    <EventMask MinDelay="250" />
                                                    <ExtraParams> 
                                                        <ext:Parameter Name="test" Value="App.someComponent.getValue()" Mode="Raw" />                                                    
                                                    </ExtraParams> 
                                                </Click>
                                            </DirectEvents>
  3. #3
    read this post from matrixwebtech
    /Z

    https://forums.ext.net/showthread.ph...ge-always-show

Similar Threads

  1. Replies: 1
    Last Post: Apr 27, 2015, 5:08 PM
  2. Replies: 1
    Last Post: Apr 03, 2014, 11:30 PM
  3. Replies: 10
    Last Post: Jan 30, 2014, 11:42 PM
  4. TreePanel Directevents
    By obiwan74 in forum 2.x Help
    Replies: 1
    Last Post: Jan 02, 2013, 5:00 AM
  5. Dynamic DirectEvents
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jul 30, 2010, 12:58 PM

Posting Permissions