grid Textbox field client side event

Hi

InlineForm - grid 
one -it's possible if i select  product code(str_product_code) in grid client side event (ajax JSON ) bind price automatically 

 <ej:Column Field="str_product_code" HeaderText="Product Name"  ForeignKeyField="str_product_code"
                               ForeignKeyValue="str_product_name" TextAlign="Left" Width="90" IsPrimaryKey="true"/>
                     
 <ej:Column Field="dml_price" HeaderText="Price" TextAlign="Right" Width="80" Format="{0:C}" >
                            <NumericEditOptions DecimalPlaces="2"></NumericEditOptions>
                        </ej:Column>

Thanks
Pratheep

2 Replies

PR Pratheep October 20, 2015 05:12 AM UTC

Hi

Sorry , please consider  Inline Editing -Grid ( not inlineForm - grid).

Thanks
Pratheep

 



BM Balaji Marimuthu Syncfusion Team October 21, 2015 09:36 AM UTC

Hi Pratheep,

Thanks for contacting Syncfusion support.

Your requirement is achieved using the ActionComplete event in Grid. Refer to the sample and code example as below.
Sample: Sample-Editing

Help Document: http://help.syncfusion.com/js/api/ejgrid#events:actioncomplete




<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" >

           <ClientSideEvents  ActionComplete="actionComplete"  />

            <EditSettings AllowAdding="True" AllowDeleting="True" AllowEditing="True"></EditSettings>

            <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>

            <Columns>

                <ej:Column Field="EmployeeID" HeaderText="Employee Name" IsPrimaryKey="True"  ForeignKeyField="EmployeeID"

                    ForeignKeyValue="FirstName" TextAlign="Left" Width="90" />

                <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="75" Format="{0:C}" EditType="Numeric">

                     <NumericEditOptions DecimalPlaces="2"></NumericEditOptions>

                        </ej:Column>

            </Columns>
        </ej:Grid>




Using DropDownList select event, we have bind the value to Freight column automatically in Grid while adding the records. Refer to the help document.
http://help.syncfusion.com/js/api/ejdropdownlist#events:select


<script type="text/javascript">


      function actionComplete(args) {

            if (args.requestType == "add") {

                var proxy = this._id;

                $("#" + this._id + "EmployeeID").ejDropDownList({

                    select: function (args) {  //select event in dropdownlist

                        $.ajax({

                            url: "/Default.aspx/dropdowndata",

                            type: "POST",

                            contentType: "application/json; charset=utf-8",

                            data: JSON.stringify({ id: args.value }),

                            dataType: "json",

                            success: function (data) {

                                //set value to the Freight column

                                if ($('#' + proxy + 'Freight').hasClass("e-numerictextbox")) {

                                    var obj = $('#' + proxy + 'Freight').ejNumericTextbox("instance"); 

                                    obj.option("value", data.d);  //if using numeric text box

                                }

                                else

                                    $('#' + proxy + 'Freight').val(data.d);  //if using ordinary text box

                            }

                        });

                    }

                })

            }

        }       
    </script>



Regards,
Balaji Marimuthu


Loader.
Up arrow icon