I assigned a uniquename for that gridtemplate column.
I am having a button outside the grid
On clientclick of that button I am accessing all the rows of the grid.
I could able to read all the rows but in the cellID.innerHTML I am getting
"<INPUT class=inputsNoExpression id=ctl00_Cont_gvWorkingHours_New_ctl01_ctl04_txtSlotName value=Sree name=ctl00$Cont$gvWorkingHours_New$ctl01$ctl04$txtSlotName> "
My value is Sree
How to get that?
If that column is a bound column then I could able to get the value of the cell by cellId.InnerHTML
but here it is a template column and my unique name was set to that.
Please give the code snippet for accessing the gridtemplate cell value.
My Code:
<asp:Content ID="content" runat="server" ContentPlaceHolderID="Cont">
function AddSlot_New()
{
debugger;
var grid = window["<%= gvWorkingHours_New.ClientID %>"];
for (var i = 0; i < grid.MasterTableView.Rows.length; i++)
{
var row = grid.MasterTableView.Rows[i];
var cellID = grid.MasterTableView.GetCellByColumnUniqueName(row, "txtSlotName");
alert(cellID.innerHTML);
}
}
<rad:RadGrid ID="gvWorkingHours_New" runat="server" Skin="Default" AutoGenerateColumns="false"
OnNeedDataSource="gvWorkingHours_New_NeedDataSource" OnItemDeleted="gvWorkingHours_New_ItemDeleted">
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
<MasterTableView>
<Columns>
<rad:GridTemplateColumn UniqueName="txtSlotName">
<ItemTemplate>
<asp:TextBox runat="server" ID="txtSlotName" CssClass="inputsNoExpression" Text='<%# Bind("SlotName") %>'></asp:TextBox>
</ItemTemplate>
</rad:GridTemplateColumn>
</Columns>
</MasterTableView>
</rad:RadGrid>
<asp:Button ID="LinkButton1" runat="server" width="97px" CssClass="sf-inputsLinkButton" OnClientClick="return AddSlot_New()" OnClick="LinkButton1_Click"/>
</asp:Content>
Regards
Sreedhar Ambati