Problem with telerik:GridTemplateColumn

15 posts, 0 answers
  1. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 Link to this post

    Hello guys,

    i'm having problem with gridtempletecolumn, when i add boundcolums the data shown properly but when i use templetecolum it does not show the data, can any one solve my problem.

    check images below for more clearification
  2. Jeffrey
    Jeffrey avatar
    5 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    Could you show come of your code?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Jeffrey Link to this post

    <telerik:RadGrid ID="GVSeries" GridLines="None" runat="server" AllowAutomaticDeletes="True"
                                AllowAutomaticInserts="true" AllowFilteringByColumn="true" AllowSorting="true" PageSize="10" Skin="Default" OnItemDeleted="GVSeries_ItemDeleted" OnItemInserted="GVSeries_ItemInserted"
                                OnItemUpdated="GVSeries_ItemUpdated"  OnPreRender="GVSeries_PreRender" AllowAutomaticUpdates="True" AllowPaging="True"
                                AutoGenerateColumns="False" Width="100%" OnBatchEditCommand="GVSeries_BatchEditCommand" ItemStyle-Font-Size="Larger" HeaderStyle-Font-Size="Larger" CommandItemStyle-Font-Size="Larger" Font-Size="Larger">
                                <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="SeriesID"
                                    HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                                    <BatchEditingSettings EditType="row" OpenEditingEvent="Click" SaveAllHierarchyLevels="false" />
                                    <SortExpressions>
                                        <telerik:GridSortExpression FieldName="SeriesID" SortOrder="Ascending" />
                                    </SortExpressions>
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="ElementID" HeaderStyle-Width="50px" HeaderText="ElementID" SortExpression="ElementID"
                                         UniqueName="ElementID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Title" HeaderStyle-Width="50px" HeaderText="Title" SortExpression="Title"
                                            UniqueName="Title">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Description" HeaderStyle-Width="50px" HeaderText="Description" SortExpression="Description"
                                            UniqueName="Description">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Sequence" HeaderStyle-Width="50px" ItemStyle-Wrap="true" HeaderText="Sequence" SortExpression="Sequence"
                                            UniqueName="Sequence">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SeriesTypeID" HeaderStyle-Width="50px" ItemStyle-Wrap="true" HeaderText="SeriesTypeID" SortExpression="SeriesTypeID"
                                            UniqueName="SeriesTypeID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Stack" HeaderStyle-Width="50px" ItemStyle-Wrap="true" HeaderText="Stack" SortExpression="Stack"
                                            UniqueName="Stack">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Color" HeaderStyle-Width="50px" ItemStyle-Wrap="true" HeaderText="Color" SortExpression="Color"
                                            UniqueName="Color">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="FunctionName" HeaderStyle-Width="50px" ItemStyle-Wrap="true" HeaderText="FunctionName" SortExpression="FunctionName"
                                            UniqueName="FunctionName">
                                        </telerik:GridBoundColumn>
                                      
                                       <telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                <%# Eval("Show_As_Parameter")%>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:CheckBox Text="text" runat="server" />
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridButtonColumn ConfirmText="Are you sure you want delete this reord?" ConfirmDialogType="RadWindow"
                                            ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="30px" ButtonType="ImageButton"
                                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                        </telerik:GridButtonColumn>
                                         <%--<telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
                                            HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
                                        </telerik:GridEditCommandColumn>--%>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings AllowKeyboardNavigation="false">
                                    <Selecting AllowRowSelect="true"></Selecting>
                                </ClientSettings>
                            </telerik:RadGrid>
  5. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    when i add this code it does not show any data as shown in image:

    <telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                <%# Eval("Show_As_Parameter")%>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:CheckBox Text="text" runat="server" />
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>
  6. Jeffrey
    Jeffrey avatar
    5 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    First off, you are missing the parameter datafield in your templatecolumn. 
     <%# Eval("Show_As_Parameter")%>
    It isn't possible to find data since there is none.
    For myself I used the following example to make my own version work: 
    https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultvb.aspx?#qsf-demo-source
  7. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Jeffrey Link to this post

    i also tries that, added the datafield but the same result still.
  8. Jeffrey
    Jeffrey avatar
    5 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    Did you also at the other values as shown in example?
    Also did you bind your datasource or do you bind from codebehind?
  9. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 Link to this post

    i request you guys to kindly have another look at my images and code one more time for clear understanding of my problem, my whole project is stuck due to this single problem.

    help me please.
  10. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Jeffrey Link to this post

    yes on all values, and the datta is bound from codebehind.
    everything is working fine until i add templetecolumn, as soon as i add templete column the grid goes wild.
  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    Hi Sajjad,

    I guess you are binding the grid using simple data binding. Please make sure that your  RadGrid must be bound using declarative data sources or through the NeedDataSource event. When using declarative data sources or the NeedDataSource event, RadGrid can automatically accommodate the appropriate database operations without the need for you explicitly handle any sorting, paging, grouping, and so on. When you have complex operation like Inserting, deleting, and updating records ,Grouping, Hierarchy relations, Filtering, Sorting and Paging these methods are recommended. Please try and let me know if any concern.

    Thanks,
    Princy
  12. Sajjad A.
    Sajjad A. avatar
    9 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 in reply to Princy Link to this post

    i tried adding datasource with NeedDataSource event, but the result is still same :(
  13. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Mar 2014 in reply to Sajjad A. Link to this post

    Hi Sajjad,

    I see that you are doing automatic CRUD operation and binding the Grid from code behind. When having Automatic CRUD operation you should use Declarative DataSource, and if you are doing your Insert/Update/Delete operation through Manual CRUD you can use NeedDataSource event. Please take a look at this demo to know the difference in Manual CRUD Operations and Automatic Operations.
    Please provide your code behind as well if this didn't help.

    Thanks,
    Princy
  14. Eric Downey
    Eric Downey avatar
    52 posts
    Member since:
    Oct 2006

    Posted 03 Jul 2014 in reply to Sajjad A. Link to this post

    Yeah, I'm getting the exact same issue.  Without the GridTemplateColumn all is well.  Add a very simple GridTemplateColumn and my grid goes blank except for the label in the GridTemplateColumn and the button columns.  Here's my grid.  It's super simple - not much to it.

    <telerik:RadGrid ID="rgClassGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="odsClassGrid" GridLines="None" Width="875px">
            <MasterTableView DataSourceID="odsClassGrid" DataKeyNames="Id" >
                <Columns>
                    <telerik:GridButtonColumn UniqueName="editColumn" Text="Edit" HeaderStyle-Width="75px" />
                    <telerik:GridHyperLinkColumn   HeaderStyle-Width="75px" Text="Sessions" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Teacher/ManageSessions.aspx?ClassId={0}" />
                    
                    <telerik:GridBoundColumn UniqueName="titleColumn" HeaderText="Title" DataField="Name" HeaderStyle-Width="350px" />
                    <telerik:GridBoundColumn UniqueName="startDateColumn" HeaderText="Start Date" DataField="StartDate" HeaderStyle-Width="100px" />
                    <telerik:GridBoundColumn UniqueName="endDateColumn" HeaderText="End Date" DataField="EndDate" HeaderStyle-Width="100px" />
                    <telerik:GridTemplateColumn HeaderText="Draft" HeaderStyle-Width="100px">  
                        <ItemTemplate>  
                            <asp:Label ID="Label1" runat="server" Text='<%# Convert.ToBoolean(Eval("Draft")) ? "Yes" : "No" %>' />  
                        </ItemTemplate>  
                    </telerik:GridTemplateColumn> 

                    <telerik:GridButtonColumn UniqueName="deleteColumn" Text="Delete" HeaderStyle-Width="75px" />
                    
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
  15. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 08 Jul 2014 Link to this post

    Hi Eric,

    I've created a sample RadGrid web site using the provided code snippet to test the described behavior. On my side the grid is loaded and displayed as expected. Please run the attached application and let me know about the result.

    Regards,
    Eyup
    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.

     
  16. Mohamed
    Mohamed avatar
    1 posts
    Member since:
    Mar 2014

    Posted 01 Oct 2015 Link to this post

    I had The Same Problem And I Solved It .. In my case The problem was That my Application I Used Telerik 2013 Pack And I updated my package to 2014 and the solution was made with 2013 pack The Solution is to remove  References of    Telerik.Web.UI   and Telerik.Web.UI.Skins   and re add the new references from The New Package from path 

    C:\Program Files (x86)\Telerik\UI for ASP.NET AJAX Q2 2014\Bin45

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