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

hide default update and cancel buttons

9 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 24 Feb 2010, 06:10 AM

see my code below for the GridTemplateColumn

<telerik:GridTemplateColumn HeaderText="Edit" UniqueName="Edit" HeaderStyle-Width="20px" FilterControlWidth="20px">  
   <ItemTemplate> 
        <asp:LinkButton runat="server" CommandName="Edit" CommandArgument='<%# Eval("Id") %>' Visible='<%# Eval("CanEdit") %>' ID="ibEdit" Text="Edit" /> 
   </ItemTemplate> 
   <EditItemTemplate> 
         <asp:LinkButton runat="server" ID="lbUpdate" CommandName="Update" CommandArgument='<%# Eval("Id") %>' Text="Update" OnClientClick="return ConfirmUpdate()"  /> 
         <asp:LinkButton runat="server" ID="lbCancel" Text="Cancel" CommandName="Cancel" /> 
   </EditItemTemplate> 
</telerik:GridTemplateColumn> 

At runtime when i clicked on "Edit" for a grid item the default Update and Cancel buttons appearred together with my linkbuttons.... Is it possible to hide the default Update and Cancel buttons?
thanks in advance

9 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 24 Feb 2010, 07:09 AM
Hello,

You can use following snippet to hide default editor buttons:
1.<EditFormSettings>
2. <EditColumn Visible="false"></EditColumn>
3.</EditFormSettings>


All the best,
Nikolay
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.
0
Jo
Top achievements
Rank 1
answered on 01 Mar 2010, 10:24 AM
hi

im also facing the same problem..i need to hide the default buttons...but default buttons are in wizardnavigationcontrol.ascx page (differnt page)  i need to hide in welcomewizard.aspx ..pls let me know

the code is like this in wizardnavigatiocontrol.ascx

<

 

asp:Button ID="btCancel" runat="server" Text="Cancel"

 

 

onclick="btCancel_Click" />

 

 

<asp:Button ID="btBack" runat="server" Text="Back" onclick="btBack_Click" />

 

 

<asp:Button ID="btNext" runat="server" Text="Next" onclick="btNext_Click" />

 



thanks
kolluru
0
Nikolay Rusev
Telerik team
answered on 03 Mar 2010, 05:10 PM
Hello kolluru,

Did you tried the suggestion from the last post in this thread?
Is should be working for you.

Best wishes,
Nikolay
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.
0
Jo
Top achievements
Rank 1
answered on 05 Mar 2010, 08:44 AM
Hi Nikolay

The last post in this thread is not useful for me....My buttons code is in the "wizardnavigation.ascx" page..these buttons defaultly display in all my aspx pages...how can access the one of button called "Back" button in my aspx page..i need to "Back" button will be visible = false in only "welcome.aspx" page only....anyway thanks for remembering my problem...pls send me the solution asap..
0
Nikolay Rusev
Telerik team
answered on 10 Mar 2010, 09:50 AM
Hello Jo,

Bellow is illustrated one possible way of accessing your custom edit form:
1.private void RadGrid1_ItemCreated(object  sender, Telerik.Web.UI.GridItemEventArgs e)
2.{
3. if(e.Item is GridEditFormItem && e.Item.IsInEditMode)
4. {
5.   UserControl MyUserControl = e.Item.FindControl (GridEditFormItem.EditFormUserControlID) as UserControl;
6.//Find the button in the user control and manipulate it
7.  }
8.}


Best wishes,
Nikolay
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.
0
TSCGlobal
Top achievements
Rank 1
answered on 21 Apr 2010, 04:03 PM
Is there a way to hide the edit/update button based on the the data in another column on the ItemDatabound event?

For example, I've figured out this much of the code;

    Private Sub rgOrders_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgOrders.ItemDataBound  
 
        If TypeOf e.Item Is GridDataItem Then  
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)  
            Dim status As String = item("Status").Text  
            Dim EditButton As LinkButton = 'dont know how to access this control.  
 
            If status = "Processing" Then  
                EditButton.Visible = False 
            End If  
        End If  
 
    End Sub 
but I don't know how to access the edit/update button directly...
0
Princy
Top achievements
Rank 1
answered on 22 Apr 2010, 07:49 AM
Hi,

You could try the following code in ItemDataBound event to access the Edit link and set the Visible property.

VB:
 
Protected Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) 
    If TypeOf e.Item Is GridDataItem Then 
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) 
        Dim EditButton As LinkButton = DirectCast(item("AutoGeneratedEditColumn").Controls(0), LinkButton) 
        Dim status As String = item("CompanyName").Text 
        If status = "A1" Then 
            EditButton.Visible = False 
        Else 
            EditButton.Visible = True 
        End If 
    End If 
End Sub 
 


Regards,
Princy.
0
Blankchq Information Technologies
Top achievements
Rank 1
answered on 21 Mar 2013, 06:19 PM
Hi ,

I am using following code  for radgrid when i click my custom edit image it show UPDATE and CANCEL button find following code for reference

<telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
                                                        <telerik:RadGrid ID="Grid" HeaderStyle="50px" runat="server" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True"
                                                            OnItemDataBound="Grid_ItemDataBound" OnPageIndexChanged="Grid_PageIndexChanged"
                                                            OnSortCommand="Grid_SortCommand"  OnPageSizeChanged="Grid_PageSizeChanged" OnItemCommand="Grid_ItemCommand" GridLines="None">
                                                            <ExportSettings ExportOnlyData="True">
                                                            </ExportSettings>
                                                            <MasterTableView AutoGenerateColumns="False" TableLayout="Auto" PagerStyle-AlwaysVisible="true" DataKeyNames="MenuMasterId">
                                                                <Columns>
                                                                    <telerik:GridBoundColumn DataField="MenuMasterId" FilterControlAltText="Filter MenuMasterId column"
                                                                        HeaderText="Menu Master Id" ReadOnly="True" SortExpression="MenuMasterId" UniqueName="MenuMasterId">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridBoundColumn DataField="MenuName" FilterControlAltText="Filter MenuName column"
                                                                        HeaderText="Menu Name" ReadOnly="True" SortExpression="MenuName" UniqueName="MenuName">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridBoundColumn DataField="ParentMenuId" FilterControlAltText="Filter ParentMenuId column"
                                                                        HeaderText="Parent Menu Id" ReadOnly="True" SortExpression="ParentMenuId" UniqueName="ParentMenuId">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column"
                                                                        HeaderText="Description" ReadOnly="True" SortExpression="Description" UniqueName="Description">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridBoundColumn DataField="PageUrl" FilterControlAltText="Filter PageUrl column"
                                                                        HeaderText="Page U R L" ReadOnly="True" SortExpression="PageUrl" UniqueName="PageUrl">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridBoundColumn DataField="AllowWithoutLogin" FilterControlAltText="Filter AllowWithoutLogin column"
                                                                        HeaderText="Allow Without Login" ReadOnly="True" SortExpression="AllowWithoutLogin" UniqueName="AllowWithoutLogin">
                                                                        <HeaderStyle Width="13%"></HeaderStyle>
                                                                    </telerik:GridBoundColumn>
                                                                    <telerik:GridTemplateColumn FilterControlAltText="" AllowFiltering="False" UniqueName="EditColumn">
                                                                        <ItemTemplate>
                                                                            <asp:LinkButton ID="btnEdit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "MenuMasterId")%>'
                                                                                runat="server" CausesValidation="false" CommandName="Edit"
                                                                                Text=""><img src="Images/editIcon.gif" /></asp:LinkButton>
                                                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                                            <asp:LinkButton ID="btnDelete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "MenuMasterId")%>'
                                                                runat="server" CausesValidation="false" CommandName="Delete"
                                                                Text="" OnClientClick="return confirm('Are you sure you want to Delete this record?');"><img src="Images/deleteIcon.gif" /></asp:LinkButton>
                                                                        </ItemTemplate>
                                                                        <ItemStyle Width="5%" />
                                                                    </telerik:GridTemplateColumn>
                                                                </Columns>
                                                                <EditFormSettings>
                                                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                                    </EditColumn>
                                                                </EditFormSettings>

                                                            </MasterTableView>
                                                            <FilterMenu EnableImageSprites="False">
                                                            </FilterMenu>
                                                        </telerik:RadGrid>
                                                    </telerik:RadAjaxPanel>


When i click the image it displays Update and Cancel button.

I would like to hide those

Please help

0
Shinu
Top achievements
Rank 1
answered on 22 Mar 2013, 04:01 AM
Hi,

Please try the following code snippet to hide the Update and Cancel Button.

C#:
protected void Grid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem editForm = (GridEditableItem)e.Item;
        LinkButton updateButton = (LinkButton)editForm.FindControl("UpdateButton");
        updateButton.Visible = false;
        LinkButton cancelButton = (LinkButton)editForm.FindControl("CancelButton");
        cancelButton.Visible = false;
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
sf
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Jo
Top achievements
Rank 1
TSCGlobal
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Blankchq Information Technologies
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or