Ok,
I have a grid I am updating from a RadWindow. The user clicks SAVE and the data is sent to the database. the window closes and calls the grid refresh method.
All works great. I look at the new data getting pulled during the NeedDataSource event and it is indeed correct.
However, the page never updates with the new data. The grid is defintely rebound, as the Item_Created event fires.. but why doesn't the grid show the refresh data? Am I missing something? Below is my code.
Thanks!
//ASPX PAGE
<telerik:RadGrid ID="radData" runat="server" AutoGenerateColumns="False" AllowSorting="True" OnItemCreated="radData_ItemCreated" BorderStyle="None" Skin="Telerik" GridLines="None" OnNeedDataSource="radData_NeedDataSource" Width="985px" Height="800px">...
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
//JAVASCRIPT
function ShowForm(site, form, rowIndex) {
if (form == 'refViewer') {
var grid = $find("<%= radData.ClientID %>");
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[rowIndex];
row.selected = true;
}
window.radopen(site, form);
return false;
}
function refreshGrid(arg) {
$find("<%=RadAjaxManager1.ClientID%>").ajaxRequestWithTarget("<%=RadAjaxManager1.ClientID%>", "Rebind");
}
</script>
</telerik:RadCodeBlock>
//CODE BEHIND....
protected void radData_NeedDataSource(object source, GridNeedDataSourceEventArgs e){
bindData();
private
void bindData()
{
var ds = getDs();
dv = new DataView {Table = ds.Tables[0]};
// grab some query strings for filtering
var clcFilter = Request.QueryString["clcfilter"];
var filter = Request.QueryString["filter"];
var bc = Request.QueryString["bc"];
var keyword = Request.QueryString["k"];
// if filter on, do some checks
if (filter != null)
dv.RowFilter = getFilter(filter);
if (clcFilter != null)
dv.RowFilter = bc != null ? getCLCFilter(clcFilter) : getCLCFilter(clcFilter);
// check for keyword search
if (!string.IsNullOrEmpty(keyword))
dv.RowFilter = getSearch(keyword);
radData.DataSource = dv;
fillEntities();
}
protected void radData_ItemCreated(object sender, GridItemEventArgs e)
{
if (!(e.Item is GridDataItem)) return;
var dr = (DataRowView) e.Item.DataItem;
var temp = dr["uniStatus"];
var editLink = e.Item.FindControl("RefLink") as HyperLink;
if (editLink == null) return;
editLink.Text = dr["EntityName"].ToString();
editLink.Attributes["href"] = "#";
var site = "Ref.aspx?entityid=" + dr["EntityID"];
editLink.Attributes["onclick"] = string.Format("return ShowForm('{0}','{1}', '{2}');", site,
"refViewer", e.Item.ItemIndex);
}
Sean