This is a migrated thread and some comments may be shown as answers.

[Solved] Weird binding issue

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 21 Aug 2009, 04:58 AM
Got a weird problem - when clicking on my button to populate the grid based on search criteria, it first gives gives an error saying this._postBackSettings.async' is null or not an object, then click it again, returns empty result, third click - everything works fine!! Any subsequent searches on the same page work as expected... Don't know what to do!! Here's code:

<

 

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadGrid1">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="grdSearch" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<telerik:RadGrid ID="grdSearch" AllowPaging="true" AllowSorting="true" runat="server" AutoGenerateColumns="false"

 

 

OnItemDataBound="grdSearch_ItemDataBound" OnNeedDataSource="grdSearch_NeedDataSource">

 

 

<ExportSettings>

 

 

<Pdf FontType="Subset" PaperSize= "A4" />

 

 

<Excel Format="Html" />

 

 

<Csv FileExtension="csv" ColumnDelimiter="Comma" RowDelimiter="NewLine" />

 

 

</ExportSettings>

 

 

<MasterTableView TableLayout="Auto">

 

 

<Columns>

 

 

<telerik:GridHyperLinkColumn

 

 

DataTextFormatString="'{0}'"

 

 

DataNavigateUrlFields="DebtorId"

 

 

UniqueName="DebtorsNo"

 

 

DataNavigateUrlFormatString="DebtorDetails.aspx?did={0}"

 

 

HeaderText="Debtors No"

 

 

DataTextField="DebtorsNo">

 

 

</telerik:GridHyperLinkColumn>

 

 

<telerik:GridHyperLinkColumn

 

 

DataTextFormatString="'{0}'"

 

 

DataNavigateUrlFields="DebtorId"

 

 

UniqueName="DebtorName"

 

 

DataNavigateUrlFormatString="DebtorDetails.aspx?did={0}"

 

 

HeaderText="Name"

 

 

DataTextField="DebtorName">

 

 

</telerik:GridHyperLinkColumn>

 

 

<telerik:GridBoundColumn

 

 

DataField="Postcode"

 

 

DataType="System.String"

 

 

HeaderText="Postcode"

 

 

SortExpression="Postcode"

 

 

UniqueName="Postcode">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Is Active" UniqueName="TemplateColumn">

 

 

<ItemTemplate>

 

 

<asp:CheckBox id="statusChkBox" runat="server"

 

 

Checked='<%# Eval("Active") %>' Enabled="false">

 

 

</asp:CheckBox>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

<FilterMenu EnableTheming="True">

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

</FilterMenu>

 

 

</telerik:RadGrid>

 



protected

 

void Page_Load(object sender, EventArgs e)

 

{

 

if (!Page.IsPostBack)

 

{

 

CommonHelper.SetFocus(txtSearch);

 

grdSearch.DataSource =

new int[] { };

 

 

//Response.Redirect("NotImplemented.aspx");

 

}

}

 

void BindGrid()

 

{

 

DebtorCollection debtorCollection = new DebtorCollection();

 

 

try

 

{

debtorCollection =

DebtorManager.Search(txtSearch.Text);

 

}

 

catch (Exception ex)

 

{

lblError.Text = ex.Message;

}

grdSearch.DataSource = debtorCollection;

 

//grdSearch.DataBind();

 

}

 

protected void btnSearch_Click(object sender, EventArgs e)

 

{

 

//BindGrid();

 

grdSearch.Rebind();

}

 

protected void grdSearch_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

//if (e.Item is GridPagerItem)

 

 

//{

 

 

// lblTotalNoRecords.Text = "Total number of records found: " + (e.Item as GridPagerItem).Paging.DataSourceCount.ToString();

 

 

//}

 

}

 

protected void grdSearch_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 

{

BindGrid();

}

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Aug 2009, 09:33 AM
Hello Joe,

I suggest you modify the RadAjaxManager's settings this way:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid1"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="grdSearch" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="grdSearch"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Joe
Top achievements
Rank 1
answered on 24 Aug 2009, 12:37 AM
Thanks Daniel,

With your suggestion, the issue has become less regular - it doesn't occur every time
but still it does happen... What else do you think we can do?
0
Daniel
Telerik team
answered on 24 Aug 2009, 06:49 AM
Hello Joe,

Could you please post your markup here so I can try to provide more to-the-point answer?
Alternatively you could attach a runnable copy of your project to a regular support ticket. This way I will be able to debug it locally.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Joe
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Joe
Top achievements
Rank 1
Share this question
or