9 Answers, 1 is accepted

Here is a sample code for accessing the BoundColumn cell text and template column values from client side on an external Button click.
aspx:
<
telerik:RadGrid
runat
=
"server"
ID
=
"RadGrid1"
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
>
<
MasterTableView
DataKeyNames
=
"EmpId"
ClientDataKeyNames
=
"EmpId"
EditMode
=
"EditForms"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Name"
HeaderText
=
"Name"
UniqueName
=
"Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
Text
=
"xxx"
></
asp:TextBox
>
<
telerik:RadTextBox
ID
=
"RadTextBox"
runat
=
"server"
></
telerik:RadTextBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
OnClientClick
=
"ButtonClick(); return false"
/>
Javascript:
function
ButtonClick(btn)
{
var
grid = $find(
"<%=RadGrid1.ClientID %>"
);
var
masterTable = grid.get_masterTableView();
var
rows = masterTable.get_dataItems();
for
(
var
i = 0; i < rows.length; i++)
{
masterTable.getColumnByUniqueName(
"Name"
).get_element();
//accessing Bound Columns
alert(rows[i].get_cell(
"Name"
).innerText);
var
txtingrid = rows[i].findElement(
'TextBox1'
);
//accessing asp controls
alert(rows[i].findControl(TextBox1));
var
radtextbox = rows[i].findControl(RadTextBox);
//accessing Ajax controls
alert(rows[i].findControl(RadTextBox));
}
}
Thanks,
Shinu.

I have a template column with item template,edit item template,insert item template, so that at the time of insert new record inserted item template control and other bound control with property readonly false in inserted row is visible to take new inserted value at the time of add new record button click.
I want to access InsertItemTemplate control and bound column cell of inserted row in my javascript function.
Html Code is following.
eem
<telerik:GridTemplateColumn DataField="PRGCAT_CODE"
HeaderText="Category Code"
FilterControlAltText="Filter PRGCAT_CODE column" UniqueName="PRGCAT_CODE" >
<EditItemTemplate>
<asp:TextBox ID="txtprgcodeedit" runat="server"
Text='<%# Eval("PRGCAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imgeditpopup" runat="server"
ImageUrl="~/Images/popup.gif" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="prgcatcodeins" runat="server"
Text='<%# Eval("PRGCAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imginspopup" runat="server"
ImageUrl="~/Images/popup.gif" />
</InsertItemTemplate>
<ItemTemplate >
<asp:Label ID="Label2" runat="server" Text='<%# Eval("PRGCAT_CODE") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Font-Bold="True" Font-Size="12px" Width="190px" />
<ItemStyle Width="170px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="PRGCAT_NAME"
FilterControlAltText="Filter PRGCAT_NAME column" HeaderText="BANNER CATEGORY"
UniqueName="PRGCAT_NAME">
<HeaderStyle Font-Bold="True" Font-Size="12px" Width="150px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
In this code i want to access insertitem template column text box control id (prgcatcodeins) of PRGCAT_CODE template column and PRGCAT_NAME bound column that is in inserted row at the time of add new record in javascript function

Attahced is a small sample.
Best wishes,Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.


I think you are not getting my point what i want to ask you.the code which you have send me its not working in inplace mode.i have sent you java script through which i am getting control when it is in editmode from edititem template column but not in insertitem template control and nonitem template column cell when my grid is in inplace insert mode.please reply me as soon as possible.i am waiting..
my java script code is following call on button click.
function validatedw() {
var grid = $find("<%=grdBannerBrowse.ClientID%>").get_masterTableView();
if (grid is inplace insert new row mode) {
var obj = $telerik.findElement($telerik.$("div.rgEditForm")[0], "prgcatcodeins");//this line raise error
}
and my html code is
<telerik:RadGrid
ID="grdBannerBrowse" runat="server" AllowPaging="True" AutoGenerateColumns="False"
GridLines="None"
OnNeedDataSource="grdBannerBrowse_NeedDataSource"
OnPageIndexChanged="grdBannerBrowse_PageIndexChanged" Height="300px"
Width="100%" PageSize="14" AllowSorting="True"
AllowFilteringByColumn="True" CellSpacing="0"
onitemdatabound="grdBannerBrowse_ItemDataBound"
onitemcommand="grdBannerBrowse_ItemCommand" onitemcreated="grdBannerBrowse_ItemCreated"
>
<mastertableview
datakeynames="ROW_ID,BANNER_NAME,BANNER_CODE"
PagerStyle-Mode="NextPrevAndNumeric" ClientDataKeyNames="BANNER_CODE,ROW_ID"
EditMode="InPlace" InsertItemDisplay="Bottom"
>
<CommandItemTemplate >
<div style="padding: 5px 5px;">
<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# grdBannerBrowse.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Edit.gif" />Edit selected</asp:LinkButton>
<asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# grdBannerBrowse.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Update.gif" />Save</asp:LinkButton>
<asp:LinkButton ID="btnsave" runat="server" CommandName="PerformInsert" Visible='<%# grdBannerBrowse.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/Insert.gif" /> Save</asp:LinkButton>
<asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# grdBannerBrowse.EditIndexes.Count > 0 || grdBannerBrowse.MasterTableView.IsItemInserted %>'><img style="border:0px" alt="" src="Images/Cancel.gif" /> Cancel</asp:LinkButton>
<asp:LinkButton ID="btnaddnew" runat="server" CommandName="InitInsert" Visible='<%# !grdBannerBrowse.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"
runat
="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete selected Row</asp:LinkButton>
</div>
</CommandItemTemplate>
<Columns>
<telerik:GridTemplateColumn UniqueName="ArrowColumn">
<ItemTemplate>
<img id="imgarror" src="Images/arrow.gif" style="display: none;" />
</ItemTemplate>
<HeaderStyle Width="30px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="BANNER_CODE"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderStyle-HorizontalAlign="Left" HeaderText="CODE" Resizable="false"
ReadOnly="True">
<HeaderStyle Font-Bold="true" Font-Size="12px" Width="120px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="BANNER_NAME"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderStyle-HorizontalAlign="Left" HeaderText="DESCRIPTION"
Resizable="false" ReadOnly="True">
<HeaderStyle Font-Bold="true" Font-Size="12px" Width="250px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn DataField="PRGCAT_CODE"
HeaderText="Category Code"
FilterControlAltText="Filter PRGCAT_CODE column" UniqueName="PRGCAT_CODE" >
<EditItemTemplate>
<asp:TextBox ID="txtprgcodeedit" runat="server"
Text='<%# Eval("PRGCAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imgeditpopup" runat="server"
ImageUrl="~/Images/popup.gif" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="prgcatcodeins" runat="server"
Text='<%# Eval("PRGCAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imginspopup" runat="server"
ImageUrl="~/Images/popup.gif" />
</InsertItemTemplate>
<ItemTemplate >
<asp:Label ID="Label2" runat="server" Text='<%# Eval("PRGCAT_CODE") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Font-Bold="True" Font-Size="12px" Width="190px" />
<ItemStyle Width="170px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="PRGCAT_NAME"
FilterControlAltText="Filter PRGCAT_NAME column" HeaderText="BANNER CATEGORY"
UniqueName="PRGCAT_NAME">
<HeaderStyle Font-Bold="True" Font-Size="12px" Width="150px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn DataField="CBPAT_CODE"
FilterControlAltText="Filter CBPAT_CODE column" HeaderText="CB PATTRN CODE"
UniqueName="CBPAT_CODE">
<EditItemTemplate>
<asp:TextBox ID="txtcbpatedit" runat="server" Text='<%# Eval("CBPAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imgbaneredit" runat="server"
ImageUrl="~/Images/popup.gif" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtcbpatadd" runat="server" Text='<%# Eval("CBPAT_CODE") %>'></asp:TextBox>
<asp:ImageButton ID="imgbanerinspopup" runat="server"
ImageUrl="~/Images/popup.gif" />
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Eval("CBPAT_CODE") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="190px" Font-Bold="True" Font-Size="12px" />
<ItemStyle Width="150px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="CBPAT_NAME"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderText="CB PATTRN">
<HeaderStyle Font-Bold="true" Font-Size="12px" Width="250px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="IS_LIVE"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderText="LIVE" ReadOnly="True"><HeaderStyle Font-Bold="true" Font-Size="12px"
Width="150px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="UPDATE_USER"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderText="UPDATED BY" ReadOnly="True">
<HeaderStyle Font-Bold="true" Font-Size="12px" Width="150px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="UPDATE_DATE"
DataType="System.String" Display="true" EmptyDataText="N/A"
HeaderText="UPDATED ON" ReadOnly="True">
<HeaderStyle Font-Bold="true" Font-Size="12px" Width="150px" />
<ItemStyle Width="150px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="true" DataField="ROW_ID"
DataType="System.String" Display="false" EmptyDataText="N/A"
HeaderText="ROW_ID" ReadOnly="True">
</telerik:GridBoundColumn>
</Columns>
<
CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<rowindicatorcolumn>
</rowindicatorcolumn>
<expandcollapsecolumn>
</expandcollapsecolumn>
</mastertableview>
<clientsettings
EnableRowHoverStyle="true" ReorderColumnsOnClient="True" >
<selecting allowrowselect="True" EnableDragToSelectRows="False" />
<ClientEvents OnRowSelecting="RowSelecting" OnRowDeselected="RowDeselected" OnRowSelected="RowSelected" />
<Scrolling
AllowScroll="True" UseStaticHeaders="True" />
<Animation AllowColumnReorderAnimation="True"
AllowColumnRevertAnimation="True" />
</clientsettings>
<
FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
How can i access object of my text box control id is (prgcatcodeins) in the insertitem template column and BANNER CATEGORY nontemplate column cell in my javascript function when the grid is inplace insert new row mode.
Your all previous solution are not fullfill my requerment.

Attached is a small sample.
Regards,Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.