Add multiple rows to far point spread sheet control(7.0) in asp.net

Posted by: mounika-fp on 8 September 2017, 3:08 pm EST

  • Posted 8 September 2017, 3:08 pm EST

    I added a context menu in farpoint spread control(7.0 version) with a textbox to give the number of rows to be added.I was trying to handle this through javascript.I used the command document.getElementById(spreadsheet).Add(index,no of rows).But this command always adds single row to the end of the spread sheet component.I wanted to add a the user specified rows after the active row.Is it possible in javascript?If this is not possible through javascript, is there a way to handle it through a event handler over the context menu item? I dont see any event handlers over the context menu item in VS.I can do it in C# if I can have an event handler over the contextmenu item.Any help would be appreciated.
  • Replied 8 September 2017, 3:08 pm EST

    Hello,

    You should be able to listen to the FpSpread1_MenuItemClicked event server side. Here you can get to know which item is clicked if you find this to be "Add Row" you can add a row at desired postiion. For example:

     Protected Sub FpSpread1_MenuItemClicked(sender As Object, eventArgs As FarPoint.Web.Spread.MenuItemClickEventArgs) Handles FpSpread1.MenuItemClicked

    If eventArgs.SelectedItem.ToString()
    =="Add Row" Then

    'Do your stuff

    End If

    End Sub

     

    Thanks,

  • Replied 8 September 2017, 3:08 pm EST

    Hi,  

    Thanks for the reply.It works.I also wanted to know if we could add a context menu item like this : Have a label saying Add Rows and a textbox for the user to enter the number of rows.And get the value in the textbox and add those many rows.

  • Replied 8 September 2017, 3:08 pm EST

    Hello,

    It is a very unique and interesting requirement. But I doubt if it is a feasible enough to implement. I have attached a sample application showing adding a row with context menu client side, Please have a look at it.

    Now coming back to your requirement,  instead of showing a text box in context menu we can show a modal pop up window on selection of "Add Rows" from context menu with a TextBox in it. Later we can get the number entered in the text box and call FpSpread1.Add() method same number of times to add rows. I do not have a sample application right now to demonstrate this but you may try this at your end and let me know if need any assistance.

     

    Thanks,


    2013/05/AddRowsToSpreadWithContextMenu.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels