Hi,
My grid has template column with textbox in item template and textbox in footer template. The aspx looks like this:
<telerik:GridTemplateColumn AllowFiltering="False" FilterControlAltText="Filter Amount column" Groupable="False" HeaderText="Amount" Reorderable="False" ShowFilterIcon="False" UniqueName="Amount" HeaderTooltip="Amount">
<HeaderStyle Width="17%"></HeaderStyle>
<ItemTemplate>
<asp:TextBox ID="txtAmount" runat="server" Width="75%" CssClass="rightalign" onblur="return txtAccountAmount_Blur
(event);" />
</ItemTemplate>
<FooterTemplate>
<asp:Literal ID="Literal1" runat="server" ><span style='color: Black; font-weight:
bold;'>Sum:</span></asp:Literal>
<asp:TextBox ID="txtAmountTotal" runat="server" Width="75%" CssClass="rightalign" />
</FooterTemplate>
</telerik:GridTemplateColumn>
Then I have function on this local aspx page as:
function txtAccountAmount_Blur(evnt){
var txtBox = ((evnt.target) ? evnt.target : evnt.srcElement);
var isValid = Currency_Validate( txtBox );
SetGridCurrencyTextBoxError(isValid, txtBox, evnt);
return isValid;
}
In global javascript:
function SetGridCurrencyTextBoxError(isValid, txtBox, evt){
var cell = txtBox.parentNode;
var errorMsg = document.getElementById(cell.id + "_spnError");
if(!isValid){//Was not valid currency value.
if(!errorMsg){
errorMsg = document.createElement('span');
errorMsg.className = 'inlineerrortext';
errorMsg.innerHTML = 'Invalid currency value.';
errorMsg.id = cell.id + "_spnError";
cell.insertBefore(errorMsg, txtBox);
}
}
Cell.id is always empty. I used developer tools to debug. There is textbox id. I see it. It is something like this:
Ctl00_maincontent_rgdAccounts_ctl00_ctl04_txtAmount . As far as I know, parent id should be - Ctl00_maincontent_rgdAccounts_ctl00_ctl04
Please let me know how to get id of parentnode
Thanks,
Prathiba