Hi all,
why does onupdatecommand and onitemupdated not fierd ?? here is the codes :
aspx :
<telerik:RadGrid ID="RadGrid1" runat="server" OnItemUpdated="companyGridUpdated"
AllowPaging="True" AllowSorting="True" OnUpdateCommand="companyGridUpdate"
AutoGenerateColumns="False" GridLines="None" Skin="Vista" AllowAutomaticUpdates="True">
<MasterTableView ShowFooter="True" DataKeyNames="ID">
<Columns>
<telerik:GridBoundColumn UniqueName="ID" DataField="ID" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="CompanyID" DataField="CompanyID" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Name" DataField="Name" UniqueName="Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Notes" DataField="Notes" UniqueName="Notes">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Status" DataField="Status" UniqueName="Status">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="IP Address" DataField="IPAddress" UniqueName="IPAddress">
</telerik:GridBoundColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
<FormTemplate>
<table id="Table1" style="padding:5px;">
<tr valign="top">
<td colspan="2">
<br />
<b>Edit details for
<asp:Label Id="Label1" Text='<%#Bind("Name") %>' runat="server"></asp:Label>
</b><br />
</td>
</tr>
<tr valign="top">
<td>
Node Server Name :
</td>
<td>
<telerik:RadTextBox runat="server" Text='<%#Bind("Name") %>'
ID="RadEditNodeName" DataTextField="Name"></telerik:RadTextBox>
</td>
</tr>
<tr valign="top">
<td>
Node Server Details :
</td>
<td>
<telerik:RadTextBox runat="server" Text='<%#Bind("Notes") %>'
ID="RadEditNodeNotes" DataTextField="Notes"></telerik:RadTextBox>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<asp:Button ID="btnUpdate" Text="Update" runat="server" CausesValidation="False" CommandName="Update">
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
<asp:HiddenField ID="GridEditableValue" runat="server" />
CS :
protected void Panel_Load(object sender, System.EventArgs e)
{
BTServerNode[] nodes = (BTServerNode[])ViewState["NODES"];
if (nodes == null)
{
BTServerNodeFactory nodeFactory = new BTServerNodeFactory(ConnectionString);
nodes = nodeFactory.GetNodesByCompany(AdminUser.CompanyID);
ViewState["NODES"] = nodes;
}
RadGrid1.DataSource = nodes;
RadGrid1.DataBind();
}
protected void companyGridUpdate(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName.Equals("Update"))
{
RadTextBox nameBox = (RadTextBox)e.Item.FindControl("RadEditNodeName");
RadTextBox notesBox = (RadTextBox)e.Item.FindControl("RadEditNodeNotes");
GridEditableValue.Value = nameBox.Text + ";" + notesBox.Text;
}
}
protected void companyGridUpdated(object sender, Telerik.Web.UI.GridUpdatedEventArgs e)
{
//TODO: save the values from GridEditableValue to db.
}