GridTemplateColumn of RadGrid displays Button like plan text

2 posts, 0 answers
  1. Nsi
    Nsi avatar
    6 posts
    Member since:
    Oct 2011

    Posted 18 Feb 2014 Link to this post

    RadGrid displays Button like plan text. 
     <Columns>
     <telerik:GridBoundColumn HeaderText="On Calendar" DataField="IsOnCalendar" UniqueName="IsOnCalendar" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" />
                                <telerik:GridBoundColumn HeaderText="Status" DataField="Status" UniqueName="Status" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" Visible="false" FilterControlWidth="80px" />
     <telerik:GridTemplateColumn UniqueName="UpdateColumn" AllowFiltering="False">
       <ItemTemplate>
       <asp:Button ID="btnInactiveButton" ToolTip="Mark Inactive" runat="server" Text="Inactive" CommandName="Update" CommandArgument="0"            SkinID="defaultbutton" OnClientClick="return confirm('Are you sure you want to deactivate this?');" CausesValidation="false" />
    <asp:Button ID="btnActivatebutton" ToolTip ="Mark Active" runat="server" Text="Activate" CommandName="Update" CommandArgument="1" SkinID="defaultbutton"
                                            OnClientClick="return confirm('Are you sure you want to activate this?');" CausesValidation="false" />
         </ItemTemplate>
     </telerik:GridTemplateColumn>
    </Columns>

    Buttons btnActivatebutton and btnInactiveButton show up like normal text. User will not know that they are buttons until they hover over them. I need fix for this.  Thnaks.



  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Feb 2014 in reply to Nsi Link to this post

    Hi,

    Im not able to replicate such an issue at my end. I see that you have used SkinId for the buttons, make sure that the style is not affecting the look and feel of the Button. Please have a look at the below sample code snippet which works as expected.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowFilteringByColumn="true" AllowMultiRowSelection="true" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" />
                <telerik:GridBoundColumn HeaderText="Name" DataField="Name" UniqueName="Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                <telerik:GridTemplateColumn UniqueName="UpdateColumn" AllowFiltering="False">
                    <ItemTemplate>
                        <asp:Button ID="btnInactive" runat="server" Text="Inactive" OnClientClick="return confirm('Inactive');" />
                        <asp:Button ID="btnActivate" runat="server" Text="Activate" OnClientClick="return confirm('Activate');" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    C#:
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        dynamic data = new[] {
    new { ID = 1, Name = "Name1"},
    new { ID = 2, Name = "Name2"},
    new { ID = 3, Name = "Name3"},
    new { ID = 4, Name = "Name4"},
    new { ID = 5, Name = "Name5"},
    new { ID = 6, Name = "Name6"},
    new { ID = 7, Name = "Name7"},
    new { ID = 8, Name = "Name8"},
    new { ID = 9, Name = "Name9"}
    };
        RadGrid1.DataSource = data;
    }

    Thanks,
    Shinu
Back to Top