i try the Examples but its not working javascript value throw null alert
its my coding
vb.net
--------
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles RadGrid1.ItemCreated |
If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then |
Dim editFormItem As GridEditFormItem = CType(e.Item, GridEditFormItem) |
Dim box As TextBox = editFormItem.FindControl("txtName") |
RadGrid1.Controls.Add(New LiteralControl("<script type='text/javascript'>window['NameId'] = '" & box.ClientID & "';</script>")) |
End If |
End Sub |
Javascript
------------
<script language="javascript" type="text/javascript">
function GetValue()
{
var Names= document.getElementById(window['
NameId']);
if(!Names)
{
alert("no item in edit/insert mode available");
return false;
}
else
{
alert("Title edited value is: " + Names.value);
}
}
</script>
aspx custom Editable grid
--------
<EditFormSettings EditFormType="Template" >
<FormTableItemStyle Wrap="False"></FormTableItemStyle>
<FormCaptionStyle CssClass="RadGridHeader"></FormCaptionStyle>
<FormMainTableStyle BackColor="White" GridLines="Horizontal" CellPadding="3" Width="100%" CellSpacing="0"></FormMainTableStyle>
<FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px" BackColor="White" />
<FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
<EditColumn CancelText="Cancel edit" InsertText="Insert Order" UniqueName="EditCommandColumn1" ButtonType="ImageButton" UpdateText="Update record">
</EditColumn>
<FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
<FormTemplate >
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr><td style="height:3px;" colspan ="2"></td></tr>
<tr>
<td align="right" colspan="2">
<asp:ImageButton ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' ImageUrl="~/Images/icons/Update.gif"
runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' OnClientClick="return fn_GetValue()">
</asp:ImageButton>
<asp:ImageButton ID="Button1" Text="Cancel" runat="server" CausesValidation="False" ImageUrl="~/Images/icons/CancelEdit.gif"
CommandName="Cancel" OnClientClick="DeleteHiddenvalue()"></asp:ImageButton>
</td>
</tr>
<tr>
<td >
<asp:TextBox ID="txtName" runat="server" EnableTheming ="true" Text='<%#Eval("name") %>' ></asp:TextBox> </td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
HELP ANY ONE ......THANKS