Hi,
I have a simple problem but have been having a frustrating time figuring this out. I have a html table which has two rows 'trExistingCustomer' and 'trNewCustomer'. I have an edit popup form on the grid. I want to show a certain row and hide the other based on what command the grid is trying to do (Inset / Edit). I use Jquery in a RadCodeBlack to do this, I am firing a function on the ClientEvent OnPopUpShowing. how I can I check if this was triggered from Insert comand or Edit command in the javascript. I already tried using the function onCommand (Please see code) I saw another example and thought this might be the relevant function but this is not working and it displays all rows. Can someone please show an example in code how to check for the calling command in the popup function or onCommand to do this right? Also is there a list of all client side events asscociated with the edit form and the grid somewhere, I think that would be helpful to know. Any help is appreciated
I have a simple problem but have been having a frustrating time figuring this out. I have a html table which has two rows 'trExistingCustomer' and 'trNewCustomer'. I have an edit popup form on the grid. I want to show a certain row and hide the other based on what command the grid is trying to do (Inset / Edit). I use Jquery in a RadCodeBlack to do this, I am firing a function on the ClientEvent OnPopUpShowing. how I can I check if this was triggered from Insert comand or Edit command in the javascript. I already tried using the function onCommand (Please see code) I saw another example and thought this might be the relevant function but this is not working and it displays all rows. Can someone please show an example in code how to check for the calling command in the popup function or onCommand to do this right? Also is there a list of all client side events asscociated with the edit form and the grid somewhere, I think that would be helpful to know. Any help is appreciated
HTML table in Edit popup form in RadGrid <table id="tblEditPopup" style="width:100%; height:100%"> <tr id="trExistingCustomer" > <td align="right"> Select Existing Customer: </td> <td> <telerik:RadComboBox ID="cboxCustomers" runat="server" AutoPostBack="true" DataSourceID="CustomerObjectDataSource" DataTextField="CustomerName" DataValueField="customer_id" SelectedValue='<%# Bind("customer_id") %>' > </telerik:RadComboBox> </td> <td align="right"> Abbreviation: </td> <td> <asp:TextBox ID="txtCustAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>' ></asp:TextBox> </td> </tr> <tr id="trNewCustomer" > <td align="right"> Customer Name: </td> <td> <asp:TextBox ID="txtCustomerName" runat="server" Text='<%# Bind("CustomerName") %>' ></asp:TextBox> </td> <td align="right"> Abbreviation: </td> <td> <asp:TextBox ID="txtNewAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>' ></asp:TextBox> </td> </tr> <tr> <td align="right"> City: </td> <td> <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>' ></asp:TextBox> </td> <td align="right"> State: </td> <td> <telerik:RadComboBox ID="cboxStates" runat="server" DataSourceID="StatesObjectDataSource" DataTextField="description" DataValueField="description" AutoPostBack="false" SelectedValue='<%# Bind("State") %>'> </telerik:RadComboBox> </td> </tr> <tr> <td align="center" colspan="4" style="" > <asp:Button ID="BtnSubmit" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> <asp:Button ID="BtnCancel" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" /> </td> </tr> </table> GRID's CLIENT SIDE EVENTS <ClientSettings> <ClientEvents OnPopUpShowing="PopUpShowing" OnCommand="onCommand" /> </ClientSettings> JAVASCRIPT <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> var popUp; function PopUpShowing(sender, eventArgs) { popUp = eventArgs.get_popUp(); //This works when the popup comes up but how can I tell if its called from the Edit or Insert command?? $('#trExistingCustomer').css('display', 'block'); $('#trNewCustomer').css('display', 'none'); } //This seems a more logical place to put this but this does not work , is there another command I should be checking for?? function onCommand(sender, args) { if (args.get_commandName() == "InitInsert") { $('#trExistingCustomer').css('display', 'block'); $('#trNewCustomer').css('display', 'none'); } else if(args.get_commandName() == "InitEdit") { $('#trExistingCustomer').css('display', 'block'); $('#trNewCustomer').css('display', 'none'); } </script> </telerik:RadCodeBlock>