This is a migrated thread and some comments may be shown as answers.

InitInsert

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fatih ak
Top achievements
Rank 1
fatih ak asked on 30 Jul 2009, 09:45 AM
    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" 
                    AutoGenerateColumns="False" AllowFilteringByColumn="True" 
                    ShowStatusBar="True" OnUpdateCommand="RadGrid1_UpdateCommand"  
                    OnInsertCommand="RadGrid1_InsertCommand" 
                    OnDeleteCommand="RadGrid1_DeleteCommand"  
                    OnNeedDataSource="RadGrid1_NeedDataSource"  
                    OnItemDataBound="RadGrid1_ItemDataBound"  
                    ShowFooter="True" Skin="Vista" onitemcommand="RadGrid1_ItemCommand"
                     
                    <MasterTableView DataKeyNames="MuhFisDetayId" AllowMultiColumnSorting="True" 
                        CommandItemDisplay="Top" EditMode="InPlace" InsertItemDisplay="Top"
                        <Columns> 
                             <telerik:GridDropDownColumn DataField="HesapId" DataSourceID="LLBLGenProDataSource3" 
                                HeaderText="HesapKodu" ListTextField="HesapKodu" ListValueField="HesapId" UniqueName="HesapId"
                                <ItemStyle HorizontalAlign="Left" Width="160px" /> 
                             </telerik:GridDropDownColumn> 
                             
                             <telerik:GridTemplateColumn HeaderText="Açıklama" UniqueName="TemplateColumnAciklama" EditFormColumnIndex="1"
                                <ItemTemplate> 
                                    <%# Eval("Aciklama")%> 
                                </ItemTemplate> 
                                 
                                <EditItemTemplate> 
                                    <telerik:RadTextBox runat="server" ID="tbAciklama"   DataType="Decimal"  
                                        Text='<%# Bind("Aciklama") %>' Width="180px"
                                    </telerik:RadTextBox> 
                                </EditItemTemplate> 
                                
                                <FooterTemplate> 
                                <asp:Label runat="server" ID="lblFooterAciklama" Text=" Toplam Borç - Alacak " Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> 
                                </FooterTemplate> 
                                <ItemStyle HorizontalAlign="Left" Width="200" Wrap="true"/> 
                           </telerik:GridTemplateColumn> 
                             
                            <telerik:GridTemplateColumn HeaderText="Borç" UniqueName="TemplateColumnBorc" EditFormColumnIndex="1"
                                 
                                <ItemTemplate> 
                                    <%# Eval("Borc" )%> 
                                </ItemTemplate> 
                                 
                                <EditItemTemplate> 
                                   <telerik:RadNumericTextBox runat="server" ID="tbBorc" Width="40px" DbValue='<%# Bind("Borc")  %>' DataType="Decimal"
                                   <ClientEvents OnKeyPress="onKeyPresstbBorc" /> 
                                   </telerik:RadNumericTextBox> 
                                </EditItemTemplate> 
                                 
                                <FooterTemplate> 
                                <asp:Label runat="server" ID="lblBorcToplam" Text="" Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> 
                                </FooterTemplate> 
                                 
                              <ItemStyle HorizontalAlign="Left" Width="120px" /> 
                            </telerik:GridTemplateColumn> 
                                  
                            <telerik:GridTemplateColumn HeaderText="Alacak" UniqueName="TemplateColumnAlacak" 
                                EditFormColumnIndex="2"
                                 
                                <ItemTemplate> 
                                    <%# Eval("Alacak")%> 
                                </ItemTemplate> 
                                 
                                <EditItemTemplate> 
                                    <telerik:RadNumericTextBox runat="server" ID="tbAlacak" Width="40px" DbValue='<%# Bind("Alacak")  %>' DataType="Decimal"
                                    <ClientEvents OnKeyPress="onKeyPresstbAlacak" /> 
                                    </telerik:RadNumericTextBox> 
                                </EditItemTemplate> 
                                 
                                <FooterTemplate> 
                                 <asp:Label runat="server" ID="lblAlacakToplam" Text="" Font-Bold="true" Font-Names="Verdana" ForeColor="#000000"></asp:Label> 
                                </FooterTemplate> 
                                 
                                 
                              <ItemStyle HorizontalAlign="Left" Width="120px" /> 
                            </telerik:GridTemplateColumn> 
                             
                            <telerik:GridEditCommandColumn UpdateText="Kaydet" UniqueName="EditCommandColumn"  
                                CancelText="İptal" EditText="Güncelle"
                              <ItemStyle HorizontalAlign="Center" Width="100" /> 
                         </telerik:GridEditCommandColumn> 
                         <telerik:GridButtonColumn   UniqueName="DeleteColumn" Text="Sil" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Bu Kaydı Silmek İstediğinizden Eminmisiniz" ItemStyle-Width="50" ItemStyle-HorizontalAlign="Center" /> 
                         </Columns> 
                         <EditFormSettings CaptionFormatString="{0} nolu Fişi Güncelleme" CaptionDataField="MuhFisDetayId"
                            <EditColumn ButtonType="ImageButton" /> 
                            <FormStyle BackColor="#eef2ea" Width="100%" /> 
                            <FormTableStyle CellPadding="2" CellSpacing="0" GridLines="None" /> 
                            <FormTableItemStyle Height="29px" Width="100%" /> 
                         </EditFormSettings> 
                    </MasterTableView> 
                    
                    <ClientSettings>  
                        <ClientEvents OnRowCreated="onRowCreated" OnRowCreating="onRowCreating" OnRowDblClick="RowDblClick" OnCommand="onCommand" /> 
                    <Selecting AllowRowSelect="true" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 


In grid there is two column (TemplateColumnBorc , TemplateColumnAlacak) Which has RadNumericTexBox in Edit and İnsert mode .
İ want to make "0" the value of others radnumerictextbox when i write something in one of them .

İn Edit Mode İ accomplish it  with Javascript

                       var currentRowIndex = null;                
 
                        function onCommand(sender, args) 
                        {          
                                 if(args.get_commandName()== 'Edit')  
                                 {     
                                   currentRowIndex = args.get_commandArgument();  
                                 } 
                        }   
                         
                        function onKeyPresstbBorc(sender, eventArgs) 
                        { 
 
                          var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();  
                          var dataItem = masterTable.get_dataItems()[currentRowIndex]; 
                          var radTextBox1 = dataItem.findControl("tbAlacak"); 
                          radTextBox1.set_value(0.00); 
                        }
                       
                        function onKeyPresstbAlacak(sender, eventArgs)
                        {
                          var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();
                          var dataItem = masterTable.get_dataItems()[currentRowIndex];
                          var radTextBox1 = dataItem.findControl("tbBorc");
                          radTextBox1.set_value(0.00);
                        }

But When İ Click "Add new row" a new row creating on grid  inlinemode .

i want to accomplish make 0 value of other radcombobox when i write something one of them  before Performinsert .



































1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 05 Aug 2009, 06:56 AM
Hello fatih,

One possible option in this case would be to get a reference to the EditForm and GridEditFormInsertItem from the code-behind. There, you can reference the particular RadTextBox, which will trigger an update of the other controls. You can assign an onValueChanging/onValueChanged client side handler(s), and access the other element(s) on the edit/insert form, to alter their values.
I hope this suggestion helps.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
fatih ak
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or