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

Client-Side Binding with GridTemplateColumn

3 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Levi
Top achievements
Rank 1
Levi asked on 12 May 2009, 11:56 PM
Does anyone have any examples of Client-Side Binding with GridTemplateColumn? I have a grid that is linked to a web service. All of my fields update except my template fields. There is a get_cell() that returns a reference to a regular column but not a template one. It almost seems like you have to use all regular columns then manually replace the HTML using javascript. Is there a better way or any examples that might help me? I have lots of places where i have two lines of data in a single field.

Thanks!
Levi

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 15 May 2009, 06:18 AM
Hello Levi,

When using client-side data-binding and GridTemplateColumn column you have two options to populate template with data:
 - add control in the ItemTemplate with ID same as DataField which should be shown in that column cell
 - listen for RowDataBound client event, find cell in question and populate it manually with data.

I hope this helps.

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
NetDeveloper1107
Top achievements
Rank 1
answered on 22 Apr 2010, 06:59 AM
How can we bind the values manually do you have examples on it,I am stucked with it. I have done as below
Grid design


<telerik:RadGrid ID="RadGridTask" runat="server" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
                                AllowAutomaticInserts="False" GridLines="None"  AllowCustomPaging="True" PageSize="5"
                                EnableViewState="false" AllowSorting="true" OnItemCommand="RadGrid1_ItemCommand" >
                                 <MasterTableView AutoGenerateColumns="False">
                                 <Columns>
                                <telerik:GridTemplateColumn SortExpression="TaskName" DataField="taskName" HeaderText="Link Button Task Name">
                                    <ItemTemplate>
                                        <asp:LinkButton runat="server" id="taskName"></asp:LinkButton>
                                    </ItemTemplate>
                                 </telerik:GridTemplateColumn>                                 
                                  <telerik:GridBoundColumn DataField="taskId" UniqueName="taskId" HeaderText="Task ID"
                                    EmptyDataText="&amp;nbsp;" SortExpression="taskId">
                                  </telerik:GridBoundColumn>
                                  <telerik:GridBoundColumn DataField="workFlowTaskId" UniqueName="workFlowTaskId" HeaderText="Workflow Task ID"
                                    EmptyDataText="&amp;nbsp;" SortExpression="workFlowTaskId">
                                  </telerik:GridBoundColumn>
                                   </Columns>
                                 </MasterTableView>
                                 <ClientSettings>
                                 <ClientEvents OnCommand="RadGridTask_Command" OnRowDataBound ="RowDataBound" />
                                 </ClientSettings>
                          </telerik:RadGrid>

RowDatabound Function code



function RowDataBound(sender,args)
{
debugger;
    var lnkTaskName = args.get_item().findControl("TaskName");
    lnkTaskName.set_value(args.get_dataItem()["taskName"]);

}

I am getting lnkTaskName  as null - I have done the same ways mentioned in the below example

http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx

Can you figure out what is wrong



0
Nikolay Rusev
Telerik team
answered on 22 Apr 2010, 01:25 PM
Hello NetDeveloper1107,

As you have duplicated your posts I have answer you on the following forum thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-client-side-binding-with-gridtemplatecolumn-and-labels.aspx

Regards,
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.
Tags
Grid
Asked by
Levi
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
NetDeveloper1107
Top achievements
Rank 1
Share this question
or