I an new to RadGrid and run in to a issue when using Client-Side Insert - In my grid, I have one buttoncolumn and two boundcolumn. What I want to do is to add a new row into my grid by clicking a button out of the grid, pretty simple, right? However, when using Client-Side insert by calling a javascript function, the new row is added and two boundcolumns are populated properly, but leaves buttoncolumn blank. Here is the ASPX code:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type ="text/javascript" >
var custodian =
{
CustodianID:null,
EmailAddressID: null,
EmailAddress: null,
create: function() {
var obj = new Object;
obj.CustodianID = 0;
obj.EmailAddressId = "";
obj.EmailAddress = "";
}
};
function updateChanges() {
PageMethods.AddCustodian("asd", updateGrid);
//MyWebService.UpdateEmployeeByEmployee(getValues(), updateGrid);
}
function updateGrid(result) {
var tableView = $find("<%= rgCustodians.ClientID %>").get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
//var grid = $find("<%= rgCustodians.ClientID %>");
//grid.repaint();
}
</script>
</telerik:RadCodeBlock>
<span><telerik:RadTextBox ID="tbCustomdian" runat="server" Width ="200px">
</telerik:RadTextBox></span>
<span style ="margin-left:5px; vertical-align:middle" >
<asp:Button ID="btnAddCustodian" runat="server"
Text="<%$Resources:Labels, add %>" Width ="100px"
OnClientClick="updateChanges(); return false;" /></span>
<telerik:RadGrid ID="rgCustodians" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteColumn="False" GridLines="None"
ondeletecommand="rgCustodians_DeleteCommand"
onneeddatasource="rgCustodians_NeedDataSource" Width="100%">
<MasterTableView Width="100%" TableLayout="Fixed" >
<Columns>
<telerik:GridBoundColumn HeaderText="EmailAddressId" Visible ="False" DataField="EmailAddressId" UniqueName="EmailAddressId" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Cutodians" UniqueName="EmailAddress" DataField="EmailAddress"></telerik:GridBoundColumn>
<telerik:GridButtonColumn Display ="true" Visible ="true" Text="deleee" />
</Columns>
<NoRecordsTemplate>
<div> <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Labels, norecords%>" /> </div>
</NoRecordsTemplate>
</MasterTableView>
</telerik:RadGrid>
Did I do something wrong?
Thanks in advance
Wei