Change RadGrid editable mode

9 posts, 0 answers
  1. Liji Jose
    Liji Jose avatar
    52 posts
    Member since:
    Jan 2010

    Posted 04 Mar 2010 Link to this post

    Hi ...

    Please give me a quick answer, I have an urgent requirement:
    Is Radgrid always in ediatble mode?
    I am using <telerik:GridEditCommandColumn> a one of my columns, will it make the grid to editable mode?

    In which event can I restrict the mode to non-editable?

    Please tell me where am I going wrong?

    My markup code:


    <

     

    telerik:RadGrid ID="RadGrid1" runat="server"

     

     

    AutoGenerateColumns ="false" OnNeedDataSource ="RadGrid1_NeedDataSource" OnInsertCommand ="RadGrid1_InsertCommand" EnableAJAX="True"

     

     

    OnUpdateCommand ="RadGrid1_UpdateCommand" OnDeleteCommand ="RadGrid1_DeleteCommand" OnEditCommand ="RadGrid1_EditCommand" AllowPaging="True" >

     

     

     

    <MasterTableView DataKeyNames="id" GridLines="None" Width="100%" EditMode="inplace" CommandItemDisplay ="Top" >

     

     

     

    <Columns>

     

     

    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete">

     

     

    </telerik:GridButtonColumn>

     

     

     

    <telerik:GridTemplateColumn HeaderText="ProductID" UniqueName ="MultiColumnCombo" ItemStyle-Width="240px">

     

     

    <ItemTemplate>

     

    <%

    #DataBinder.Eval(Container.DataItem, "prod_id")%>

     

     

    </ItemTemplate>

     

     

     

    <EditItemTemplate>

     

     

    <telerik:RadComboBox runat="server"

     

     

    ID="RadComboBox1"

     

     

    DataTextField="id"

     

     

    DataValueField="id"

     

     

    HighlightTemplatedItems="true"

     

     

    Height="190px"

     

     

    Width="220px"

     

     

    DropDownWidth="420px">

     

     

    <HeaderTemplate >

     

     

    <ul>

     

     

    <li class="col1">ID </li>

     

     

    <li class="col2">NAME</li>

     

     

    <li class="col3">DESCRIPTION</li>

     

     

    </ul>

     

     

    </HeaderTemplate>

     

     

    <ItemTemplate >

     

     

    <ul>

     

     

    <li class="col1"><%#DataBinder.Eval(Container.DataItem, "id")%></li>

     

     

    <li class="col2"><%#DataBinder.Eval(Container.DataItem, "name")%></li>

     

     

    <li class="col3"><%#DataBinder.Eval(Container.DataItem, "description")%></li>

     

     

    </ul>

     

     

    </ItemTemplate>

     

     

    </telerik:RadComboBox>

     

     

    </EditItemTemplate>

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <telerik:GridBoundColumn FilterControlWidth="50px" DataField="id" HeaderText="ID" SortExpression="id"

     

     

    UniqueName="id" >

     

     

    </telerik:GridBoundColumn>

     

     

    <telerik:GridBoundColumn FilterControlWidth="50px" DataField="line_id" HeaderText="Line ID" SortExpression="line_id"

     

     

    UniqueName="line_id" >

     

     

    </telerik:GridBoundColumn>

     

     

    <telerik:GridBoundColumn FilterControlWidth="50px" DataField="ship_date" HeaderText="SHIP DATE" SortExpression="ship_date"

     

     

    UniqueName="ship_date" >

     

     

    </telerik:GridBoundColumn>

     

     

    <telerik:GridBoundColumn FilterControlWidth="50px" DataField="quantity" HeaderText="Quantity" SortExpression="quantity"

     

     

    UniqueName="quantity" >

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridButtonColumn CommandName="MyCommand" ButtonType="ImageButton" UniqueName="ButtonColumn"></telerik:GridButtonColumn>

     

     

    <telerik:GridEditCommandColumn UpdateText="Update" UniqueName="EditCommandColumn"

     

     

    CancelText="Cancel" EditText="Edit">

     

     

    <HeaderStyle Width="85px"></HeaderStyle>

     

     

    </telerik:GridEditCommandColumn>

     

     

    </Columns>

     

     

     

    <ExpandCollapseColumn Visible="False">

     

     

    <HeaderStyle Width="19px"></HeaderStyle>

     

     

    </ExpandCollapseColumn>

     

     

    <RowIndicatorColumn Visible="False">

     

     

    <HeaderStyle Width="20px" />

     

     

    </RowIndicatorColumn>

     

     

    </MasterTableView>

     

     

    <ClientSettings>

     

     

    <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick"

     

     

    OnGridCreated="GridCreated" />

     

     

    </ClientSettings>

     

     

    </telerik:RadGrid>

    help me plz.............

     

  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 04 Mar 2010 Link to this post

    The GridEditCommandColumn is just a special column type that changes it's appearance depending on the edit mode. So by default, when the grid first loads it shows the edit button, but when the edit button is clicked it then changes to the update/cancel buttons. It's just an automated button for setting the edit button for the grid. It does not put the grid in edit mode.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 04 Mar 2010 Link to this post

    Hi Liji,

    I suggest you review the following help articles, which elaborates on this subject and see if they help:
    Put all items in edit mode without additional rebind
    Default edit mode for grid items on initial load

    Sincerely yours,
    Pavlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Liji Jose
    Liji Jose avatar
    52 posts
    Member since:
    Jan 2010

    Posted 05 Mar 2010 Link to this post



    Hi Pavlina,

    Thanks for ur response.

    My requirement is to bind a RadCombobox , which is in the  GridtemplateColumn of the RadGrid, to its dataSource only when the Grid is in 'Insert' OR 'Update' mode. But when In my code in page load itself it is going into the Editable mode and showing the error:Object reference not set to an instance of an object.

    Code Snippet:

     

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

     

     

    If TypeOf e.Item Is GridEditableItem Then

     

     

    Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

     

     

    Dim comboBox As RadComboBox = TryCast(item("MultiColumnCombo").FindControl("RadComboBox1"), RadComboBox)

     

    comboBox.DataSource = ComboLoadData()

    comboBox.DataBind()

     

    Dim l_strSelected As String = comboBox.SelectedValue

     

     

    End If

     

    End Sub 

    BTW, in my itemtemplate I just retrieve data from the datasource.
    My markup for the radCombobox is :

     

    <telerik:GridTemplateColumn HeaderText="ProductID" UniqueName ="MultiColumnCombo" ItemStyle-Width="240px">

     

     

    <ItemTemplate>

     

    <%

    #DataBinder.Eval(Container.DataItem, "prod_id")%>

     

     

    </ItemTemplate>

     

     

     

    <EditItemTemplate>

     

     

    <telerik:RadComboBox runat="server"

     

     

    ID="RadComboBox1"

     

     

    DataTextField="id"

     

     

    DataValueField="id"

     

     

    HighlightTemplatedItems="true"

     

     

    Height="190px"

     

     

    Width="220px"

     

     

    DropDownWidth="420px">

     

     

    <HeaderTemplate >

     

     

    <ul>

     

     

    <li class="col1">ID </li>

     

     

    <li class="col2">NAME</li>

     

     

    <li class="col3">DESCRIPTION</li>

     

     

    </ul>

     

     

    </HeaderTemplate>

     

     

    <ItemTemplate >

     

     

    <ul>

     

     

    <li class="col1"><%#DataBinder.Eval(Container.DataItem, "id")%></li>

     

     

    <li class="col2"><%#DataBinder.Eval(Container.DataItem, "name")%></li>

     

     

    <li class="col3"><%#DataBinder.Eval(Container.DataItem, "description")%></li>

     

     

    </ul>

     

     

    </ItemTemplate>

     

     

    </telerik:RadComboBox>

     

     

    </EditItemTemplate>

     

     

    </telerik:GridTemplateColumn>

    Could you plz provide me a right way with sample code?
    Eagerly awaiting for ur reply....

    -Liji Jose

     

  6. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Mar 2010 Link to this post

    Hello Liji,

    Try the following code snippet to populate RadComboBox when RadGrid in edit mode.
    VB.NET:
    Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
        If (TypeOf e.Item Is GridEditFormItem) AndAlso (e.Item.IsInEditMode) Then
            Dim insertItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
            Dim combo As RadComboBox = DirectCast(insertItem.FindControl("RadComboBox1"), RadComboBox)
            combo.DataSourceID = "SqlDataSource1"
            combo.DataTextField = "CustomerID"
            combo.DataValueField = "CustomerID"
            combo.DataBind()
        End If
    End Sub

    Additionally, you can review the following example:
    Combo in Grid

    All the best,
    Pavlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Liji Jose
    Liji Jose avatar
    52 posts
    Member since:
    Jan 2010

    Posted 09 Mar 2010 Link to this post



    Hi Pavlina,

    Thanks for ur reply. BTW, i have got the solution already...Anyways, can you just provide me a sample application for Combo in Radgrid and accessing the selectedindexchanged event of Combo at server-side and with all possible manipulations of data in radGrid.

    Can you give me the sample application in vb.net?

    -Liji Jose
  8. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Mar 2010 Link to this post

    Hi Liji,

    Please, examine the following forum thread which elaborates on this matter and see if it helps.
    http://www.telerik.com/community/forums/aspnet-ajax/grid/radcombobox-in-radgrid-cannot-get-selectedindexchanged-event.aspx

    All the best,
    Pavlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. KARTHIK
    KARTHIK avatar
    21 posts
    Member since:
    Oct 2013

    Posted 04 Apr 2014 Link to this post

    Hi,
       I have an issue to find edit form controls after radconfirm "OK" click will fire radgrid_onupdate command via javascript.
    below is the scenario,
    Click on edit form update button i have radconfirm based on some condition,once click "OK"  in radconfirm will fire radgrid_onupdatecommand event via javascript.next time i will skip the radconfirm and update

    below is the code
    Aspx code

    <telerik:RadGrid ID="RadGrid2" runat="server" Skin="Office2007" GridLines="None" AllowMultiRowEdit="true"
                Visible="true" OnPreRender="RadGrid2_PreRender" AllowFilteringByColumn="false "
                AllowPaging="True" PageSize="20" AllowSorting="True" Width="100%" AutoGenerateColumns="False"
                OnNeedDataSource="RadGrid2_NeedDataSource" OnInsertCommand="RadGrid2_InsertCommand"
                ShowStatusBar="true" AllowAutomaticUpdates="False" OnUpdateCommand="RadGrid2_OnUpdateCommand"
                HorizontalAlign="NotSet" OnItemDataBound="RadGrid2_ItemDataBound" OnItemCommand="RadGrid2_ItemCommand">
                <MasterTableView CommandItemDisplay="Top" DataKeyNames="oid,oidTradeMaster" ClientDataKeyNames="oidTradeMaster"
                    EditMode="PopUp">
                    <CommandItemTemplate>
                        <table width="100%">
                            <tr>
                                <td width="15%">
                                    <asp:LinkButton ID="btnadd" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Icons/AddRecord.png"/>&nbsp;&nbsp;Add New Record</asp:LinkButton>
                                </td>
                                <td width="55%">
                                    <asp:LinkButton ID="btnbreaktrade" OnClientClick="ShowBreakTrade();" runat="server"><image id="img1" style="border:0px;vertical-align:middle;" alt="" src="Icons/AddRecord.png"/>&nbsp;&nbsp;Break Trade</asp:LinkButton>
                                </td>
                                <td width="30%" align="right">
                                    <asp:LinkButton ID="btnrefresh" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="Icons/Refresh.png"/>&nbsp;&nbsp;Refresh</asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                    <Columns>
                        <telerik:GridEditCommandColumn UniqueName="EditColumn">
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn UniqueName="oid" HeaderText="oid" DataField="oid" DataType="System.Int32"
                            Visible="false" />
                      
                      
                        <telerik:GridBoundColumn UniqueName="StartDate" HeaderText="Start Date" DataFormatString="{0:MM/dd/yy}"
                            AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                            Visible="true" DataField="StartDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="EndDate" HeaderText="End Date" DataFormatString="{0:MM/dd/yy}"
                            AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                            Visible="true" DataField="EndDate">
                        </telerik:GridBoundColumn>
                      
                        <telerik:GridBoundColumn UniqueName="Units" HeaderText="Units" DataField="Units"
                            FilterControlWidth="30px" AllowFiltering="true" AutoPostBackOnFilter="true" Visible="true"
                            CurrentFilterFunction="Contains">
                            <ItemStyle Width="30px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="SwapPrice" HeaderText="Swap Price" FilterControlWidth="50px"
                            AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo"
                            DataField="SwapPrice">
                            <ItemStyle Width="50px" />
                        </telerik:GridBoundColumn>
                      
                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete"
                            ConfirmText="Are you sure want to delete the selected Entry?" ConfirmDialogType="Classic"
                            ConfirmTitle="Delete" ButtonType="ImageButton" ImageUrl="~/Icons/delete.png" />
                    </Columns>
                    <EditFormSettings InsertCaption="Add New Trade Detail" CaptionFormatString="Edit Trade Entry "
                        EditFormType="Template" PopUpSettings-Modal="false" PopUpSettings-Width="650"
                        PopUpSettings-Height="240">
                        <FormTemplate>
                            <asp:Panel runat="server" ID="pnldetails">
                                <table id="Table1" cellspacing="1" cellpadding="1" width="650" border="0">
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lbltradetype" runat="server" Text="Trade Type"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="chkDailyVolumes" runat="server" Checked="false" Visible="true"
                                                AutoPostBack="true" Text="Use Daily Volumes" OnCheckedChanged="Check_Clicked"
                                                ToolTip="Load Trade with Daily Volumes" />
                                            <telerik:RadComboBox ID="RcbTradeType1" EmptyMessage="Select Tradetype" runat="server"
                                                Width="110px" AutoPostBack="true" Visible="false" OnSelectedIndexChanged="RcbTradeType_SelectedIndexChanged">
                                                <Items>
                                                    <telerik:RadComboBoxItem Text="EOM" Value="EOM" />
                                                    <telerik:RadComboBoxItem Text="DOM" Value="DOM" />
                                                </Items>
                                            </telerik:RadComboBox>
                                            <telerik:RadNumericTextBox ID="RNtxtTradeday" Visible="false" Width="90px" runat="server"
                                                NumberFormat-DecimalDigits="0" EmptyMessage="Enter Trade day">
                                            </telerik:RadNumericTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Start Date:
                                        </td>
                                        <td colspan="3">
                                            <%-- <telerik:RadDateInput ID="RDIStartDate" runat="server" Width="200px" AutoPostBack="false">
                                            <ClientEvents OnValueChanging="MyValueChanging" />
                                        </telerik:RadDateInput>--%>
                                            <telerik:RadDatePicker ID="RDIStartDate" runat="server" Width="200px" AutoPostBack="false"
                                                Calendar-FastNavigationStep="12" DateInput-EmptyMessage="" MinDate="01/01/1000"
                                                MaxDate="01/01/3000">
                                            </telerik:RadDatePicker>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="RDIStartDate"
                                                Display="Dynamic" ErrorMessage="</br>* StartDate is Required." ValidationGroup="VAL" />
                                        </td>
                                        <td>
                                            End Date:
                                        </td>
                                        <td colspan="3">
                                            <%--<telerik:RadDateInput ID="RDIEndDate" runat="server" Width="200px">
                                            <ClientEvents OnValueChanging="MyValueChanging" />
                                        </telerik:RadDateInput>--%>
                                            <telerik:RadDatePicker ID="RDIEndDate" runat="server" Width="200px" AutoPostBack="false"
                                                Calendar-FastNavigationStep="12" DateInput-EmptyMessage="" MinDate="01/01/1000"
                                                MaxDate="01/01/3000">
                                            </telerik:RadDatePicker>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="RDIEndDate"
                                                Display="Dynamic" ErrorMessage="</br>*EndDate is Required." ValidationGroup="VAL" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Units:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadComboBox runat="server" ID="RcbUnits" EnableLoadOnDemand="True" OnItemsRequested="RcbUnits_ItemsRequested"
                                                AutoPostBack="false" EnableVirtualScrolling="true" ShowMoreResultsBox="true"
                                                MarkFirstMatch="true" HighlightTemplatedItems="true" Height="60px" Width="200px"
                                                DropDownWidth="200px">
                                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="RcbUnits"
                                                Display="Dynamic" ErrorMessage="</br>*Units is Required." ValidationGroup="VAL" />
                                        </td>
                                        <td>
                                            <asp:Label ID="lblperiodvolume" runat="server" Text="Period Volume"></asp:Label>
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadNumericTextBox ID="txtPeriodVolume" Width="200px" runat="server" NumberFormat-DecimalDigits="2"
                                                Text='<%# Bind( "PeriodVolume") %>'>
                                            </telerik:RadNumericTextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtPeriodVolume"
                                                Display="Dynamic" ErrorMessage="</br>*PeriodVolume is Required." ValidationGroup="VAL" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Swap Price:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadNumericTextBox ID="txtSwapPrice" Width="200px" runat="server" NumberFormat-DecimalDigits="6"
                                                Text='<%# Bind( "SwapPrice") %>'>
                                            </telerik:RadNumericTextBox>
                                            <asp:RequiredFieldValidator ID="rqfSwapPrice" runat="server" ControlToValidate="txtSwapPrice"
                                                Enabled="false" Display="Dynamic" ErrorMessage="</br>*SwapPrice is Required."
                                                ValidationGroup="VAL" />
                                        </td>
                                        <td>
                                            Floor:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadNumericTextBox ID="txtFloor" Width="200px" runat="server" NumberFormat-DecimalDigits="6"
                                                Text='<%# Bind( "Floor") %>'>
                                            </telerik:RadNumericTextBox>
                                            <asp:RequiredFieldValidator ID="rqfFloor" runat="server" ControlToValidate="txtFloor"
                                                Enabled="false" Display="Dynamic" ErrorMessage="</br>*Floor is Required." ValidationGroup="VAL" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Ceiling:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadNumericTextBox ID="txtCeiling" Width="200px" runat="server" NumberFormat-DecimalDigits="6"
                                                Text='<%# Bind( "Ceiling") %>'>
                                            </telerik:RadNumericTextBox>
                                            <asp:RequiredFieldValidator ID="rqfCeiling" runat="server" ControlToValidate="txtCeiling"
                                                Enabled="false" Display="Dynamic" ErrorMessage="</br>*Ceiling is Required." ValidationGroup="VAL" />
                                        </td>
                                        <td>
                                            Trade ID:
                                        </td>
                                        <td colspan="3">
                                            <asp:TextBox ID="txttradeiddetail" Text='<%# Bind( "TradeID") %>' runat="server"
                                                Width="200px">
                                            </asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="Tdetails">
                                        <td>
                                            Termination Date:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadDatePicker ID="RDITerminationdatedetail" runat="server" Width="200px"
                                                AutoPostBack="false" Calendar-FastNavigationStep="12" DateInput-EmptyMessage=""
                                                MinDate="01/01/1000" MaxDate="01/01/3000">
                                            </telerik:RadDatePicker>
                                        </td>
                                        <td>
                                            Terminated Volume:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadTextBox ID="txtTvoldetail" Width="200px" runat="server" Text='<%# Bind( "breakvol") %>'>
                                            </telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="Tdetails1">
                                        <td>
                                            New ExternalID:
                                        </td>
                                        <td colspan="3">
                                            <telerik:RadTextBox ID="txtnewextiddetail" Width="200px" runat="server" Text='<%# Bind( "newbreakid") %>'>
                                            </telerik:RadTextBox>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            
                            <table style="width: 100%">
                                <tr>
                                    <td align="center" colspan="2">
                                        <asp:Button ID="Button3" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            OnClientClick="disable_button(this)" ValidationGroup="VAL" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                        </asp:Button>&nbsp;
                                        <asp:Button ID="Button4" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                        </asp:Button>
                                    </td>
                                    <td>
                                        <asp:Label ID="lblerror" Font-Size="Small" Font-Bold="true" ForeColor="Red" runat="server"
                                            Text=""></asp:Label>
                                    </td>
                                    <div style="display: none">
                                        <asp:Button ID="Button1" Text="Finish" runat="server" Visible="true" OnClick="Button3_Click">
                                        </asp:Button>
                                    </div>
                                </tr>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>

    javascript that fires update commnd event

    function confirmCallBackFn1(arg) {
                  }

                    if (arg == true) {
                        document.getElementById('hdnconfirm').value = "1";
                                     
                        var masterTable = $find("<%= RadGrid2.ClientID %>").get_masterTableView();
                                            masterTable.fireCommand("update", "0");


                    }

                }

    Updatecommand event with radconfirm
    --when i clcik on radconfirm "OK" below event is firing but not able find the edit form controls.

      protected void RadGrid2_OnUpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            
            var insertedItem = e.Item as GridEditFormItem;
            if (insertedItem == null)
            {
                GridDataItem insertedItem1 = (GridDataItem)e.Item;
                insertedItem = insertedItem1.EditFormItem;
                //e.Item.Edit = true;
                //insertedItem.Edit = true;
                //GridItem item = (GridItem)RadGrid2.MasterTableView.Items[0]; // Get the first item
                //item.Edit = true; // Set in EditMode
                //RadGrid2.MasterTableView.Rebind();
                for (int i = 0; i < RadGrid1.PageSize; i++)
                {
                    RadGrid2.EditIndexes.Add(i);
                }
                //foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
                //{
                //    item.Edit = true;
                //}
                //RadGrid2.Rebind();
            }

           
            DateTime Tdate = Convert.ToDateTime(insertedItem["BreakDate"].Text);
            RadDatePicker RDIstart = (RadDatePicker)insertedItem.FindControl("RDIStartDate");
           
            if (RDITerminationdatedetail.SelectedDate != Tdate && hdnconfirm.Value == "0")
            {
                RadWindowManager1.RadConfirm("alert msg", "confirmCallBackFn1", 330, 180, null, "Terminate trade");
                return;
            }
    //update code will follow
    }

  10. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Apr 2014 Link to this post

    Hi,

    You could use the client API of RadGrid to access the edit item elements in client script as shown in this help article:
    http://www.telerik.com/help/aspnet-ajax/grid-griddataitem-get-editformitem.html

    Then, using the found object, you can find the needed controls. More information and a sample code about accessing controls in Grid Edit mode is available in the following blog post:
    http://jayeshgoyani.blogspot.in/2012/07/access-radgrid-on-client.html (refer to Access Control in Edit mode)

    Regards,
    Pavlina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017