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
<telerik:RadChart ID="radchart1" runat="server" OnBeforeLayout="radchart1_OnBeforeLayout"
AutoLayout="true" Skin="Vista" IntelligentLabelsEnabled="false" PlotArea-XAxis-AutoScale="false" ><PlotArea>
<XAxis>
<Appearance><TextAppearance TextProperties-Font="Arial, 8.25pt, style=Bold" />
<LabelAppearance RotationAngle="60"> </LabelAppearance>
</Appearance>
chartseries.Type = ChartSeriesType.Line;
chartseries.Appearance.PointMark.Visible = true;
chartseries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
chartseries.Appearance.LabelAppearance.Visible = false;
for (int i = 0; i < data.Count(); i++){
if (radchart1.PlotArea.XAxis.Items.Count() < data.Count()) radchart1.PlotArea.XAxis.AddItem(data[i].Date.ToString());
chartseries.AddItem(Convert.ToDouble(data[i].Count) > 100 ? 101 : Convert.ToDouble(data[i].Count), data[i].Count.ToString());
chartseries.Items.Last().ActiveRegion.Tooltip = data[i].Count.ToString("#,##0");
}
function to customize xaxis labels
protected void radchart1_OnBeforeLayout(object sender, EventArgs e)
{
foreach (var item in radchart1.PlotArea.XAxis.Items)
{
DateTime xaxis = Convert.ToDateTime(item.TextBlock.Text);{
item.Visible = false;
}
else{
item.TextBlock.Text = xaxis.ToString("h tt");
item.Visible = true;
}
}
}
<telerik:RadWindow ID="rwLumpSum" Modal="true" Top="0" Left="0" VisibleOnPageLoad="false" runat="server" > <ContentTemplate> <asp:UpdatePanel ID="cpLumpSum" UpdateMode="Conditional" runat="server"> <ContentTemplate> <table> <tr> <td>Lump Sum</td> <td> <telerik:RadNumericTextBox ID="rntbLumpSum" MinValue="1" MaxValue="999.99" runat="server"> <NumberFormat DecimalDigits="2" /> </telerik:RadNumericTextBox> </td> </tr> <tr> <td> <telerik:RadButton id="rbCancel" Text="Cancel" OnClientClicked="rbCancelClicked" AutoPostBack="false" UseSubmitBehavior="false" runat="server" /> </td> <td> <telerik:RadButton id="rbUpdate" Text="Update" runat="server" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate></telerik:RadWindow>function rbCancelClicked(button) { var rwLumpSum = $find("<%=rwLumpSum.ClientID%>"); rwLumpSum.Close();}Protected Sub rbUpdate_Click(sender As Object, e As EventArgs) Handles rbUpdate.Click Dim ws As CommonFunctions Dim sb As StringBuilder = Nothing sb = New StringBuilder("<SCRIPT language='javascript'>") sb.Append("var rwLumpSum = $find(") sb.Append(Chr(34)) sb.Append("<%=rwLumpSum.ClientID%>") sb.Append(Chr(34)) sb.Append(");rwLumpSum.Close();") sb.Append("</SCRIPT>") ws = New CommonFunctions() ScriptManager.RegisterStartupScript(Me, Me.GetType(), "CloseWindow", sb.ToString, False)End Sub<telerik:RadGrid runat="server" ID="grdExtraFields" AutoGenerateColumns="false" AllowPaging="true" Width="90%" Height="400px" AllowSorting="true" DataSourceID="sqlVCK" PageSize="20" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"> <MasterTableView EditMode="InPlace" AutoGenerateColumns="false"> <Columns> <telerik:GridEditCommandColumn UniqueName="btnEdit" ButtonType="LinkButton" /> <telerik:GridTemplateColumn DataField="section" HeaderText="Section Name" UniqueName="section"> <ItemTemplate> <telerik:RadComboBox ID="cboSection" runat="server" DataSourceID="sqlSection" DataTextField="description" DataValueField="section" Width="200px" Enabled="false"> </telerik:RadComboBox> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox ID="cboSection" runat="server" DataSourceID="sqlSection" DataTextField="description" DataValueField="section" Width="200px"> </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="INTERNAL_READABLE" HeaderText="Internal Name" UniqueName="internalname" /> <telerik:GridBoundColumn DataField="EXTERNAL_READABLE1" HeaderText="External Name" UniqueName="externalname" /> <telerik:GridTemplateColumn DataField="GRIDS_DATATYPE" HeaderText="Type" UniqueName="type"> <ItemTemplate> <telerik:RadComboBox ID="cboType" runat="server" selectedvalue='<%#Bind("GRIDS_DATATYPE") %>' Enabled="false"> <Items> <telerik:RadComboBoxItem Text="Label (-4)" Value="-4" /> <telerik:RadComboBoxItem Text="Label (-3)" Value="-3" /> <telerik:RadComboBoxItem Text="Key field" Value="-2" /> <telerik:RadComboBoxItem Text="System control" Value="-1" /> <telerik:RadComboBoxItem Text="Textbox" Value="1" /> <telerik:RadComboBoxItem Text="Tree" Value="4" /> <telerik:RadComboBoxItem Text="Listbox" Value="7" /> <telerik:RadComboBoxItem Text="Multi-line text" Value="9" /> <telerik:RadComboBoxItem Text="Date" Value="170" /> </Items> </telerik:RadComboBox> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox ID="cboType" runat="server" selectedvalue='<%#Bind("GRIDS_DATATYPE") %>'> <Items> <telerik:RadComboBoxItem Text="Label (-4)" Value="-4" /> <telerik:RadComboBoxItem Text="Label (-3)" Value="-3" /> <telerik:RadComboBoxItem Text="Key field" Value="-2" /> <telerik:RadComboBoxItem Text="System control" Value="-1" /> <telerik:RadComboBoxItem Text="Textbox" Value="1" /> <telerik:RadComboBoxItem Text="????" Value="4" /> <telerik:RadComboBoxItem Text="Listbox" Value="7" /> <telerik:RadComboBoxItem Text="Multi-line text" Value="9" /> <telerik:RadComboBoxItem Text="Date" Value="170" /> </Items> </telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn>... </Columns> </MasterTableView> <ClientSettings> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> </ClientSettings></telerik:RadGrid><asp:SqlDataSource id="sqlVCK" runat="server" ConnectionString="<%$ ConnectionStrings:iknetConnectionString %>" SelectCommand="select internal_readable, external_readable1, ... from grids where custfile = @custfile AND department = @dept AND section in (10, 13, 15, 16)" InsertCommand="INSERT INTO grids (SECTION, INTERNAL_READABLE, EXTERNAL_READABLE1, EXTERNAL_READABLE2, EXTERNAL_READABLE3, ..., GRIDWIDTH, REQUIRED) VALUES (@section, @fieldname, @fieldname, @fieldname, @fieldname, ..., -1, @required)" UpdateCommand="UPDATE grids SET internal_readable = @internal_readable, external_readable1 = @EXTERNAL_READABLE1, external_readable2 = @EXTERNAL_READABLE1, external_readable3 = @EXTERNAL_READABLE1, ..., section = @section where grids = @grids" DeleteCommand="DELETE FROM grids WHERE grids = @grids"> <SelectParameters> <asp:Parameter Name="custfile" type="Int32" /> <asp:Parameter Name="dept" Type="Int32" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="internal_readable" type="string" /> <asp:Parameter Name="EXTERNAL_READABLE1" type="string" /> <asp:Parameter Name="grids_datatype" type="Int32" />... <asp:Parameter Name="grids" type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="section" type="Boolean" /> <asp:Parameter Name="fieldname" type="string" /> <asp:Parameter Name="type" type="Int32" />... <asp:Parameter Name="required" type="Boolean" /> </InsertParameters> <DeleteParameters> <asp:Parameter Name="grids" type="Int32" /> </DeleteParameters></asp:SqlDataSource><telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" > <AjaxSettings> <telerik:AjaxSetting AjaxControlID="btnAddItem"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="tvProjectSummary" LoadingPanelID="RadAjaxLoadingPanel1"> </telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Width="270px" BackgroundPosition="Center" Skin="Outlook" EnableSkinTransparency="true"> </telerik:RadAjaxLoadingPanel> <telerik:RadTreeView ID="tvProjectSummary" runat="server" AllowNodeEditing="true" EnableDragAndDrop="true" Skin="Metro" OnClientNodeDropping ="SaveCtrlState" OnNodeDrop="HandleDrop"> <Nodes> <telerik:RadTreeNode Value="Root" ImageUrl="Images/subfolder_button.png" AllowEdit="true" Text="NEW PROJECT" Font-Bold="true" Selected="true"> </telerik:RadTreeNode> </Nodes> </telerik:RadTreeView> <asp:Repeater ID="rptItems" runat="server" OnItemCommand="rptItems_ItemCommand"> <ItemTemplate> <ul class="options_items"> <li> <asp:Label ID="lblItems" runat="server" Text="<%# Container.DataItem %>"></asp:Label> <asp:LinkButton ID="btnAddItem" runat="server" CommandName="AddItem" >Add+</asp:LinkButton> </li> </ul> </ItemTemplate> </asp:Repeater>