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

Help with Data Binding using GridTemplatecolumn in RadGrid

3 Answers 1690 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 03 Jun 2014, 08:25 PM
I have the below code, this so that I can get the Multiline Edit under the Auto Edit Feature. That part is working great data is bound to the edit portion, but in the actual Grid the columns are blank under these fields - the data is not being bound to the Grid, but is showing up when I open the Edit Popup Panel. Why is the data not showing in the initial grid:

Code:


<telerik:GridTemplateColumn DataField="CorrectiveAction" 
FilterControlAltText="Filter CorrectiveAction column" HeaderText="Corrective 
Action" SortExpression="CorrectiveAction" UniqueName="CorrectiveAction" 
Visible="false"><BR><EditItemTemplate><BR><asp:TextBox ID="TextBox2" 
Text='<%# Bind("CorrectiveAction")%>' Columns="30" Rows="5" 
TextMode="MultiLine" 
runat="server"></asp:TextBox><BR></EditItemTemplate><BR></telerik:GridTemplateColumn>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Jun 2014, 04:40 AM
Hi Alex,

You have to set the ItemTemplate of the GridTemplateColumn, it appears in column cells in browser mode.
Please keep in mind that when adding a template column, it is also recommended that you declare an ItemTemplate. If you do not need an ItemTemplate, you can simply omit its contents and leave it empty.

ASPX:
<telerik:GridTemplateColumn DataField="CorrectiveAction" FilterControlAltText="Filter CorrectiveAction column" HeaderText="CorrectiveAction" SortExpression="CorrectiveAction" UniqueName="CorrectiveAction" Visible="true">
  <ItemTemplate>
      <%# Eval("CorrectiveAction")%>'
  </ItemTemplate>
  <EditItemTemplate>
     <asp:TextBox ID="TextBox2" Text='<%# Bind("CorrectiveAction")%>' TextMode="MultiLine" runat="server"></asp:TextBox><br>
  </EditItemTemplate>
</telerik:GridTemplateColumn>

Thanks,
Princy
0
Aruna
Top achievements
Rank 1
answered on 01 Dec 2014, 05:42 AM
Hi 
        <rad:GridTemplateColumn UniqueName="Qty" AllowFiltering="false" HeaderText="Quantity">
                                <ItemTemplate>
                                    <rad:RadTextBox ID="txtqty" runat="server" Text='<%# Bind("Qty") %>' BorderColor="White"
                                        BorderStyle="None" Width="100px" AutoPostBack="true" OnTextChanged="txtqty_TextChanged">
                                    </rad:RadTextBox>
                                    <asp:HiddenField ID="txtisqty" runat="server" Value='<%#Bind("hIsQty") %>' />
                                </ItemTemplate>
                            </rad:GridTemplateColumn>


 Here I want to fire this "txtqty_TextChanged" ,pls help me,in this event i will show the javascript message.
0
Eyup
Telerik team
answered on 04 Dec 2014, 07:44 AM
Hi Aruna,

If you will display a script alert, you can use the client-side event of the textbox:
http://www.telerik.com/help/aspnet-ajax/input-client-side-onvaluechanged.html

Hope this helps.

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.

 
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Aruna
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or