Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2235
add and deleting rows from a button
posted

I have a data bound grid.

With adding and deleting rows turned on.

 

I need to be able to  add or delete a record on the grid from a add or delete button that is NOT on the grid.

Parents
  • 820
    posted

    For adding a row from a button ouside the grid. I m using infragistics wed image button. you can use normal asp button also.

     <igtxt:WebImageButton ID="btnAddItem" runat="server" CausesValidation="False" Text="New Item"
                                                    ToolTip="Add new Item" AutoSubmit="false">
                                                    <Appearance>
                                                        <Image Url="./Images/img_add.png" />
                                                        <ButtonStyle Cursor="Hand" Font-Names="Arial" Font-Size="8pt">
                                                        </ButtonStyle>
                                                    </Appearance>
                                                    <RoundedCorners RenderingType="Disabled" />
                                                    <HoverAppearance>
                                                        <ButtonStyle Font-Underline="True">
                                                        </ButtonStyle>
                                                    </HoverAppearance>
                                                    <Alignments VerticalImage="Bottom" />
                                                    <ClientSideEvents Click="AddRow" />
                                                </igtxt:WebImageButton> 

    I am adding a row to the  grid and setting the value of the two column in the grid.

    function AddRow(oButton, oEvent) {
         igtbl_addNew("dgGrid", 0);

         var grid = igtbl_getGridById("dgGrid");
         var activeRow = grid.getActiveRow();
         activeRow.getCellFromKey("Col1").setValue(0);  
         activeRow.getCellFromKey("col2").setValue("ABC TEXT");
         activeRow.endEditRow();   


         oEvent.needPostBack = false;
    }

    For deleting the from the button outside:

    How will you identify that which row you want to delete ?

    var row = // row you want to delete based on your condition and requirement

    row.deleteRow();

     

     

Reply Children
No Data